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
Post a Comment