摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- #画个笑脸 from graphics import * win = GraphWin() face = Circle(Point(100,95), 50) leftEye = Circle(Point(80,80) , 5) leftEye.setFill("yellow") leftEye.set... 阅读全文
posted @ 2017-11-16 18:08 hayden__wang 阅读(459) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*-#温度转换 from graphics import * win = GraphWin("摄氏温度转换器", 400, 300) win.setCoords(0.0, 0.0, 3.0, 4.0) # 绘制接口 Text(Point(1,3), " 摄氏温度:").draw(win) Text(Poi... 阅读全文
posted @ 2017-11-16 15:12 hayden__wang 阅读(477) 评论(0) 推荐(0) 编辑
摘要: 面向对象程序设计的基本步骤: 第一步:根据功能,抽象业务对象 第二步:构建独立的业务模块,利用封装、继承、多态等抽象业务需求 第三步:编写程序 第四步:以对象为单位输入参数、开展测试 阅读全文
posted @ 2017-11-16 11:36 hayden__wang 阅读(401) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- #shotput.py from math import pi,sin,cos,radians def main(): angle = eval(input("输入发射角度 (以度为单位):")) vel = eval(input("输入初始速度(以米/秒为单位):")) ... 阅读全文
posted @ 2017-11-16 11:15 hayden__wang 阅读(256) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- #matchSim.py from random import * def main(): printIntro() probA,probB,n = getInputs() winsA, winsB = simNGames(n,probA,probB) PrintS... 阅读全文
posted @ 2017-11-16 10:33 hayden__wang 阅读(329) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- #CalHamlet.py def getText(): txt = open("install.sh", "r").read() #读取整个文件 txt = txt.lower() #大写全部转成小写 for ch in '!"\'.,#... 阅读全文
posted @ 2017-11-15 15:56 hayden__wang 阅读(414) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- #利用字典将两个通讯录文本合并为一个文本 def main(): ftele2=open('TeleAddressBook.txt','rb') ftele1=open('EmailAddressBook.txt','rb') ftele1.readl... 阅读全文
posted @ 2017-11-15 13:45 hayden__wang 阅读(216) 评论(0) 推荐(0) 编辑
摘要: Python 文档资源 #注释 文件中的文档 dir函数 对象中可用属性的列表 文档字符串:__doc__ 附加在对象上的文件中的文档 PyDoc:help函数 对象的交互帮助 PyDoc:HTML报表 浏览器中的模块文档 标准手册 正式的语言和库的说明 网站资源 在线教程、例子等 出版的书籍 商业 阅读全文
posted @ 2017-11-15 11:32 hayden__wang 阅读(334) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- import turtle ##全局变量## #词频排列显示个数 count = 10 #单词频率数组-作为y轴数据 data = [] #单词数组-作为x轴数据 words = [] #y轴显示放大倍数-可以根据词频数量进行调节 yScale = 6 #x轴显示放大倍数-可以根据count数量进... 阅读全文
posted @ 2017-11-14 16:56 hayden__wang 阅读(257) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding: utf-8 -*- #利用字符串和列表将两个通讯录文本合并为一个文本 def main(): ftele1=open('TeleAddressBook.txt','rb') ftele2=open('EmailAddressBook.txt','rb') ftele1.readline()#跳过... 阅读全文
posted @ 2017-11-14 16:15 hayden__wang 阅读(159) 评论(0) 推荐(0) 编辑