File Sorting in Python -


i sort file in python based on numerical values:

my input file looks this:

66135 - 65117 - b 63301 - c 63793 - d 

output should be:

63301 - c 63793 - d 65117 - b 66135 - 

how it?

f2.writelines(sorted(f1, key=lambda line:int(line.split()[0]))) 

where f2 output file , f1 input file.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -