This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dutch58
Recipients dutch58, terry.reedy
Date 2020-11-06.18:37:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1604687849.79.0.792944285105.issue42279@roundup.psfhosted.org>
In-reply-to
Content
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)
History
Date User Action Args
2020-11-06 18:37:29dutch58setrecipients: + dutch58, terry.reedy
2020-11-06 18:37:29dutch58setmessageid: <1604687849.79.0.792944285105.issue42279@roundup.psfhosted.org>
2020-11-06 18:37:29dutch58linkissue42279 messages
2020-11-06 18:37:29dutch58create