content missing when a file is written into another file Python -
im entry level python developer working on requirement need merge many text files in forder 1 file in folder b. wrote below code working not writing entire content files in folder a.
import os = open(r"c:\temp\datsoutput\new folder\output.txt", "w") path = r'c:\temp\dats' filename in os.listdir(path): fullpath = path+"\\"+filename open(fullpath,'r',encoding="utf_8_sig", errors="ignore") ins: line in ins: a.write(line)
the around 6000 lines below line missing.
rout:= 996.6mm angl:= 95degree orrf:= =0/0 tmrref:= =0/0 repcou:= 0 end new cylinder 26 of subequipment /fa-3101/main_m1_davit name:= =805324448/24319 type:= cyli lock:= false owner:= /fa-3101/main_m1_davit purp:= unset pos:= w 537.345mm s 46.083mm u 0mm ori:= y s , z u leve:= 0 10 obst:= 2 diam:= 76.2mm heig:= 304.8mm orrf:= =0/0 tmrref:= =0/0 repcou:= 0 :pstatus:= unset end new cylinder 27 of subequipment /fa-3101/main_m1_davit name:= =805324448/24320 type:= cyli lock:= false owner:= /fa-3101/main_m1_davit purp:= unset pos:= w 537.345mm s 46.083mm u 6.125mm ori:= y s , z u leve:= 0 10 obst:= 2
for testing purpose folder has 1 file has 204034 lines , script has written 203799 lines, problem of encoding? cant go direction here small appreciated , saves job, thank you
Comments
Post a Comment