摘要:
论语是儒家学派的经典著作之一... 问题1: fi = open("论语.txt", "r") fo = open("论语-原文.txt", "w") a=0 for line in fi:#每次读完,line都是一个字符串 if a==1 and line.count("【注释】")==0 and 阅读全文
摘要:
考生文件夹下存在两个python源文件,分别对应两个问题 问题一答案: fi=open("sensor.txt","rb") fo=open("earpa001.txt","wt") for line in fi: #逐行遍历 ls=str(line,encoding="utf-8").strip( 阅读全文
摘要:
问题(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= 阅读全文