Need Help sorting alphabetically.

Chris Arai chris at araidesign.com
Tue Dec 19 03:21:37 EST 2000


Hi,

This seems like it should be obvious, but it is evading me!

I would like to sort alphabetically (I'm not sure that is the correct
term) so that strings of alpha numerics sort alphabetically instead of
by ASCII order.

eg:
>>> m=['Pg95_100.GIF',
'Pg9_100.GIF','Pg95A_100.gif','Pg9A_100.gif','Pg10_100.gif']
>>> m.sort()
>>> m
['Pg10_100.gif', 'Pg95A_100.gif', 'Pg95_100.GIF', 'Pg9A_100.gif',
'Pg9_100.GIF']


I would like the order to be
['Pg9_100.GIF', 'Pg9A_100.gif', 'Pg10_100.gif, 'Pg95_100.GIF',
Pg95A_100.gif' ]

What is the obvious answer??

Thanks,


--
Chris Arai
Arai Design
chris at araidesign.com
http://www.araidesign.com
707 431 1299
FAX 431 1599

-------------- next part --------------
A non-text attachment was scrubbed...
Name: chris.vcf
Type: text/x-vcard
Size: 224 bytes
Desc: Card for Chris Arai
URL: <http://mail.python.org/pipermail/python-list/attachments/20001219/1bc76912/attachment.vcf>


More information about the Python-list mailing list