I have imported a file containing 8 columns, each column separated by '\t', so during import all '\t' are replaced by 'space' and '\n' are split to make indexing easier for me. Then a list is generated form input file for further analysis. But after analysis I got
lst = ['PAIR', '1MFK', 'URANIUM', '82', 'HELIUM', '112', 3.6997']
kind of list, so I put
final = ' '.join(lst)
to get the values like PAIR 1MFK 1 URANIUM 82 HELIUM 112 3.6997
But when I print all values it comes as following
PAIR 1MFK 1 URANIUM 82 HELIUM 112 3.6997
PAIR 2JGH 2 PLUTONIUM 98 POTASSIUM 88 5.3003
PAIR 345G 3 SODIUM 23 CARBON 14 1.664
PAIR 4IG5 4 LITHIUM 82 ARGON 99 2.5506
here the column entries don’t lie just one below another however indentation is same for all.
I have tried with '\t' but that produce same randomized result.
please help.
If I understand you correctly, you can do something simple like this..
Here I am using a fixed column width of 10 characters. If you like, you can make it slightly more sophisticated by calculating appropriate column widths beforehand.