how to compare two strings?
phr-n2002a at nightsong.com
Tue Feb 12 09:13:22 CET 2002
Is there any built-in function in Python for comparing two strings
alphabetically? Something suitable for passing as the optional
comparison function for the list "sort" method. I could code up
if a<b: return -1
if b<a: return 1
but it's pretty ugly to need to do that. I've looked in the docs but
don't see any obvious counterpart to perl's lozenge (<=>) operator.
Is there one?
More information about the Python-list