New submission from John Dutcher <jfdutcher1...@yahoo.com>:
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) ---------- assignee: terry.reedy components: IDLE files: IBC CAP.txt messages: 380466 nosy: dutch58, terry.reedy priority: normal severity: normal status: open title: replacements function corrupts file type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file49576/IBC CAP.txt _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42279> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com