I'm Sure There's A Better Way
Aahz Maruch
aahz at panix.com
Mon Jul 9 09:24:02 EDT 2001
In article <3b4676ad$0$324$8eec23a at newsreader.tycho.net>,
Neil Macneale <mac4-devnull at theory.org> wrote:
>
>Note: this sollution requires 2 characters after the decimal point....
>
>def isDollarAmount(s):
> try:
> if s.count == 1 and s[-3] == '.':
> dol, cen = s.split('.')
> int(dol)
> int(cen)
> return 1
> int(s)
> return 1
> except:
> return None
I would change "int(dol)" to "long(dol)".
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
"How come we choose from just two people for President but more than 50
for Miss America?" --AEN
More information about the Python-list
mailing list