直接上代码
import os
path = "../data"
for dir_path, dir_names, file_names in os.walk(path):
for file_name in file_names:
print(file_name)
path = os.path.join(dir_path, file_name)
qq_file = open(path)
lines = qq_file.readlines()
for line in lines:
str = line.strip('\n').strip()
print(str)