摘要: 考生文件夹下存在两个python源文件,分别对应两个问题 问题一答案: fi=open("sensor.txt","rb") fo=open("earpa001.txt","wt") for line in fi: #逐行遍历 ls=str(line,encoding="utf-8").strip( 阅读全文
posted @ 2021-09-18 23:57 py佐料 阅读(167) 评论(0) 推荐(0)
摘要: 问题(1): txt=open("命运.txt","r").read() for ch in",。?:": txt=txt.replace(ch,"") d = {} for ch in txt: d[ch]=d.get(ch,0)+1 ls=list(d.items()) ls.sort(key= 阅读全文
posted @ 2021-09-18 20:54 py佐料 阅读(126) 评论(0) 推荐(0)