I’d want to swap two numbers on each line of the text file after replacing the equal sign with this ‘|’ and saving it, but I’m having problems doing so! As an example,
I envisioned it like follows:
As you can see, I switched 34 for 67!
This is my code:
with open('track.txt', 'r') as z: data = z.read() data = data.replace('=', '|') with open('track2.txt', 'w') as z: z.write(data)
Can I do the same thing as suggested in this doc by using slices and concatenation?
Thank you kindly! Please excuse my English.