importrefrom numpy import *
defgetStr(file_path,file_path1):
fp= open(file_path, 'r')
op= open(file_path1,'w')for eachline infp.readlines():
lines= re.split("\t| |\n",eachline)print(lines[2:10])
newlines=lines[2:10]
i=0for s innewlines:
i=i+1
if i<8:print(s)
op.write(s+',')elif i==8:
op.write(s+'\n')continue
else:breakfp.close()
op.close()if __name__ == '__main__':for i in range(483):
getStr(str(i)+'.txt','result/'+str(i)+'.txt')