摘要: 番号 阅读全文
posted @ 2017-03-22 22:13 苏阿 阅读(130) 评论(0) 推荐(0) 编辑
摘要: def file_replace(filename,old_word,new_word): f_read=open(filename) count=0 context=[] for eachLine in f_read: #print(eachLine) count+=eachLine.count(old_word) ... 阅读全文
posted @ 2017-03-22 21:15 苏阿 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 要求:用户输入文件名用户输入要显示的行数。例如,输入【10:20】,显示第10行到第20行。 【:20】 从第一行到第20行【10:】第10行到结尾 1 import os 2 3 def file_view(fileName,lineNum): 4 #判断文件是否存在 5 if fileName.strip()=="": 6 print("ERRO... 阅读全文
posted @ 2017-03-22 20:38 苏阿 阅读(311) 评论(0) 推荐(0) 编辑