Re: how to select column

2010-04-26 Thread Gary Herron
mannu jha wrote: Dear all, I am new in python, can anyone help me that how can I select two column out of 6 column from a file. For example if I have file like: a1 a2 a3 a4 a5 a6 b1 b2 b3 b4 b5 b6 c1 c2 c3 c4 c5 c6 d1 d2 d3 d4 d5 d6 and I want output like: a1 a4 b1 b4 c1 c4 d1 d4 then how

Re: how to select column

2010-04-26 Thread J. Cliff Dyer
It depends on what you mean by a column. I assume your data is more complex than what you've shown us. If your data is really single words separated by spaces, you can do: for line in open('file'): columns = line.split() return columns[0], columns[3] If your columns can

Re: Re: how to select column

2010-04-26 Thread mannu jha
Dear Sir, Thanks for your help..but yes my files are having column like: # RESIDUE AA STRUCTURE BP1 BP2 ACC N-H--OO--H-NN-H--O O--H-NTCO KAPPA ALPHA PHI PSIX-CA Y-CA Z-CA 12 A I 0 0 91 0, 0.038,-0.1 0, 0.0