We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Date: 2015-03-31 Title: Linux合并文件 Tags: Linux, Python Category: IT
我爬一个网站数据时发现,需要4个小时. 汗!不能接受!我要并发!!! 于是我需要把抓回来的文件合并在一起
import glob source_files = glob.glob("*.txt") #这里可以是任何正则 result_file = open("result.txt", "a"): for source_file in source_files: f = open(source_file, "r"): result_file.write(f.read()) f.close() result_file.close()
$ cat *.txt > result.txt
哈哈哈,就这么决定了
There was an error while loading. Please reload this page.