Have source file txt (download from accounting program) with 0a in line, when it's not needed (it makes line break). And have 0d and 0a in the place when it's needed. I need to open it in Excel ( I have another opportunity to download it in csv) When I download almost the same data in xml I encounter the same problem when getting data with python, but I've solved it by
for i in range(1,16):
lstFile.append(str(file))
lstAmount.append(str(amount))
lstKey.append(str(keys[i-1]))
if accPay.find(keys[i-1]) is None:
lstValue.append("none")
else:
lstValue.append(accPay.find(keys[i-1]).text.replace(u'\u000d',' '))
But I can't replace 0a separately.
when I write
with open(file, 'r') as file :
filedata = file.read()
filedata = filedata.replace(u'\u000a', ' ')
with open('Konten_last5.txt', 'w') as file:
file.write(filedata)
I get all 0a and 0d 0a replaced by 20 (space).
When I write
with open(file, 'r') as file :
filedata = file.read()
filedata = filedata.replace(u'\u000d', ' ')
with open('Konten_last5.txt', 'w') as file:
file.write(filedata)
I get everywhere 0d 0a in both places
please help))
I tried to replace separately (u'\u000d\u000a', 'any') but it doesn't work, this combination isn't found.
Tried solution, but it doesn't work.. couldn't attach picture in comment