Message380466
If the file below 0f 239 records is processed by the code below it throws no errors and writes the output...but the output has 615 records instead of 239 seemingly having written any revised ones three times instead of only once.
replacements = {'/1':'/01', '9/':'09/', '7/':'07/'}
file2 = open(r"c:\users\liddvdp\desktop\IBC CAP OUT.txt", "w")
with open(r"c:\users\liddvdp\desktop\IBC CAP.txt", "r") as reader:
for line in reader:
for src, target in replacements.items():
line = line.replace(src, target)
file2.write(line) |
|
Date |
User |
Action |
Args |
2020-11-06 18:37:29 | dutch58 | set | recipients:
+ dutch58, terry.reedy |
2020-11-06 18:37:29 | dutch58 | set | messageid: <1604687849.79.0.792944285105.issue42279@roundup.psfhosted.org> |
2020-11-06 18:37:29 | dutch58 | link | issue42279 messages |
2020-11-06 18:37:29 | dutch58 | create | |
|