摘要:
#!/user/bin/env python# -*- coding:utf-8 -*- # 用python中unittes中工具来测试代码 # 1.测试函数import unittestfrom name_function import get_formatted_name class Names 阅读全文
posted @ 2018-10-30 22:20
alfred_hong
阅读(172)
评论(0)
推荐(0)
摘要:
#!/user/bin/env python# -*- coding:utf-8 -*- # 1.从文件中读取数据with open('pi_digits.txt') as file_object: contents = file_object.read() # print(contents)# 末 阅读全文
posted @ 2018-10-30 22:19
alfred_hong
阅读(158)
评论(0)
推荐(0)
摘要:
#!/user/bin/env python# -*- coding:utf-8 -*- # 类名采用的是驼峰命名法,即将类名中每个单词的首字母大写,而不使用下划线。# 对于每个类,都应紧跟在类定义后面包含一个文档字符串:简要描述类的功能,并遵循写函数的文档字符串时的格式约定# 每个模块也应当包含一 阅读全文
posted @ 2018-10-30 22:18
alfred_hong
阅读(149)
评论(0)
推荐(0)
摘要:
#!/user/bin/env python# -*- coding:utf-8 -*- # 给形参指定默认值时,等号两边不要有空格 def function_name("parameter_0",parameter_1='default value')# 函数形参的位置很重要 传递参数使用关键字实 阅读全文
posted @ 2018-10-30 22:17
alfred_hong
阅读(179)
评论(0)
推荐(0)
摘要:
#!/user/bin/env python# -*- coding:utf-8 -*- # input() 可以让程序暂停工作# int(input('please input something:'))# % 取余运算 # 【标识符】# prompt = "\n Tell me somethin 阅读全文
posted @ 2018-10-30 22:17
alfred_hong
阅读(107)
评论(0)
推荐(0)
摘要:
#!/user/bin/env python# -*- coding:utf-8 -*- # 前面不用空格,后面空格# 访问只能通过keyalien_0 = {'color': 'green', 'points':5}print(alien_0['color'])print(alien_0['poi 阅读全文
posted @ 2018-10-30 22:16
alfred_hong
阅读(161)
评论(0)
推荐(0)
摘要:
#!/user/bin/env python cars = ['audi','bmw','subaru','toyota']for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title()) # == !=# < 阅读全文
posted @ 2018-10-30 22:14
alfred_hong
阅读(110)
评论(0)
推荐(0)
摘要:
magicians = ['alice','david','carolina']for magician in magicians: print(magician) print(magician.title() + ",that was a great trick!") print("I can't 阅读全文
posted @ 2018-10-30 22:13
alfred_hong
阅读(185)
评论(0)
推荐(0)

浙公网安备 33010602011771号