Python:将一个文件中的每一行复制到一个新创建的文件中,并计算文件中总共有多少行

来源:互联网 发布:怎样看龙虎榜数据 编辑:程序博客网 时间:2024/05/29 09:10
From_file=open('D:\\python\\A\\tianqi.txt')f=open('niuniu.txt','w')count=0for each_line in From_file:    f.writelines(each_line)    count+=1f.close()From_file.close()print('文件中总共有:%d行'%count)
阅读全文
0 0