How do I insert a tab into the output to a file in Python?
For example,
print >>outPutFile , c.lstrip()+"\t"+d.rstrip('\n')+"\t"+a+"\t"+b
Output:
cfn79e739_1.lp 260175 79 739
cfn100e1217_1.lp 288734 100 1217
The second line has no tab after 288734. Why?
The first line has no tab after cfn79e739_1.lp and 260175. Why?
I need to make each column at the same alignment.
'\t'.join([c.lstrip(), d.rstrip(…),…]). (2) Yourd.rstrip('\n')could probably be simplified (and made a bit more powerful) asd.rstrip(), which also strips whitespace.