- Subject: Re: what's integer() return for non integer string
- From: Jörg Sommer <joerg@xxxxxxxxxxxx>
- Date: Sun, 6 May 2007 12:01:03 +0000 (UTC)
Lechee.Lai@xxxxxxxxxxxx <Lechee.Lai@xxxxxxxxxxxx> wrote:
> hi,
> any method prevent integer("hello") return "Only digits may appear in an octal or decimal number"
> is it possible return zero for "hello"
> or any good way check string is non digits first
try
foo = integer("hello");
catch SyntaxError:
foo = 0;
BTW: Why slsh wants two semicolons at the end?
try foo = integer("test"); catch SyntaxError: foo = 0;;
Bye, Jörg.
--
Je planmäßiger ein Mensch vorgeht,
desto stärker mag ihn der Zufall treffen.
Erich Krunau ‚Die Physiker‘
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2007 date index]
[2007 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]