sorting tuples...
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Sat Sep 17 09:50:56 EDT 2005
Uhm, if the file is clean you can use something like this:
data = """\
200501221530
John
*** long string here ***
200504151625
Clyde
*** clyde's long string here ***
200503130935
Jeremy
*** jeremy string here ****"""
records = [rec.split("\n") for rec in data.split("\n\n")]
records.sort()
print records
If it's not clean, you have to put some more cheeks/cleanings.
Bye,
bearophile
More information about the Python-list
mailing list