Interesting problem comparing strings with integer values...
Chris Spencer
clspence at one.net
Wed Jan 15 18:23:09 EST 2003
Due to certain design constraints, I must be able to store both integers
and floating point numbers as strings. These strings must be able to be
compared correctly, so things like: "999"<"3432" are not possible.
One option we thought of was padding the strings with zeros, so things
like: "00000999"<"00003432" would work. This seems a bit hack-y to me. I was
wondering if anyone has a more elegant solution to the problem?
Chris.
More information about the Python-list
mailing list