04 2020 档案

摘要:1.GIF文件图像提取: 对一个GIF格式动态文件,提取其中各帧图像,并保存为文件。 1 from PIL import Image 2 3 im = Image.open('棒棒哒.gif') # 读入一个GIF文件 4 try: 5 im.save('picframe{:02d}.png'.fo 阅读全文
posted @ 2020-04-19 13:34 ghhzaq 阅读(621) 评论(0) 推荐(0)
摘要:用python进行对乒乓球比赛的分析 在一场比赛中,先得11分的获胜;若俩队同时的10分,则先超过对方2分的获胜。 单打采用7局4胜,双打采用5局3胜。 (1)单打 代码: 1 #e15.1MatchAnalysis.py 2 from random import random 3 def prin 阅读全文
posted @ 2020-04-18 11:37 ghhzaq 阅读(595) 评论(0) 推荐(0)
摘要:1 def getTaxt(): 2 txt=open('hamlet.txt') 3 txt = txt.lower() 4 for ch in '!"#$%&()*+,-./:;<=>?@[\\]^_‘{|}~': 5 txt = txt.replace(ch, " ") #将文本中特殊字符替换 阅读全文
posted @ 2020-04-06 15:21 ghhzaq 阅读(197) 评论(0) 推荐(0)