RosettaCodeData/Task/Fixed-length-records/Python/fixed-length-records.py
2023-07-01 13:44:08 -04:00

12 lines
277 B
Python

infile = open('infile.dat', 'rb')
outfile = open('outfile.dat', 'wb')
while True:
onerecord = infile.read(80)
if len(onerecord) < 80:
break
onerecordreversed = bytes(reversed(onerecord))
outfile.write(onerecordreversed)
infile.close()
outfile.close()