sorting data

Terry Reedy tjreedy at
Mon Oct 29 22:10:14 CET 2007

"Beema shafreen" <beema.shafreen at> wrote in message 
news:aa405c1f0710290224gb307d45lf8aadf16055b1d0 at
| hi all,
|           I have problem to sort the data.. the file includes data as
| follow.
| file:
| chrX:    123343123    123343182    A_16_P41787782

| how do is sort the file based on the column 1 and 2 with values......
| using sort option works for only one column and not for the other how do 
| sort both 1 and 2nd column so that the third column does not change.....
| my script

If I understand correctly, the following untested version of your code 
should do what you ask.  Otherwise, you need to be more specific.

lis = []
fh = open('chromosome_location_346010.bed','r')
for line in fh.readlines():
    data = line.strip().split('\t')
    start = data[1].strip()
    end = data[2].strip()
    probe_id  = data[3].strip()



More information about the Python-list mailing list