sorting tuples...

nidhog at gmail.com nidhog at gmail.com
Sat Sep 17 09:41:08 EDT 2005


Hello guys,

I made a script that extracts strings from a binary file. It works.

My next problem is sorting those strings.

Output is like:

---- snip ----
200501221530
John
*** long string here ***

200504151625
Clyde
*** clyde's long string here ***

200503130935
Jeremy
*** jeremy string here ****
---- snip ----

How can I go about sorting this list based on the date string that
marks the start of each message?

Should I be using lists, dictionaries or tuples?

What should I look into?

Is there a way to generate variables in a loop? Like:

x=0
while (x<10):
    # assign variable-x = [...list...]
    x = x+1

Thanks.




More information about the Python-list mailing list