I have a set of coordinate data (saved in a txt file), like this:
Number N coordinates E coordinates Height Code
1 5111945.980 444258.900 131.300 C
2 5265566.655 443665.554 110.311 BR
...
It goes on for several dozen rows like that. What I need done is to switch places of N coordinates with the ones on E coordinates (the header title also, of course) while everything else remains the same. For example, this would be the desired outcome in an output txt file:
Number E coordinates N coordinates Height Code
1 444258.900 5111945.980 131.300 C
2 443665.554 5265566.655 110.311 BR
For now, I only have the bit for printing out the table data as it shows in txt:
# open the source file
myfile = open("sometext.txt", "r")
# print out the data, to check if output working
for line in myfile:
print(line)
The data is tab spaced, as far as I can see.
I would like to solve this without external libraries, only default Python and its standard library.