how to compare two strings?
Paul Rubin
phr-n2002a at nightsong.com
Tue Feb 12 04:38:39 EST 2002
martin at v.loewis.de (Martin v. Loewis) writes:
> Can you specify "alphabetically" more precisely? Do you mean
> "lexicographically, by character ordinal value" (which is what your
> scmp code suggests)? If so, the builtin cmp() function will do;
> it compares strings just fine.
I meant exactly the same function that the sort method uses by default.
Yes it looks like cmp was what I wanted--I just didn't find it in the
obvious places in the docs (under the sort method or under string
services or string methods). Thanks.
More information about the Python-list
mailing list