[Zope] String contains only digits

Peter Bengtsson mail@peterbe.com
Wed, 29 Aug 2001 18:21:12 +0200


This has never turned me down. Perhaps not rocket surgery but useful.

try:
   is_int = int(intordigit)
except:
   is_int = 0

peter
----- Original Message ----- 
From: "Kerekes Lajos" <lkerekes@xperts.hu>
To: <zope@zope.org>
Sent: Wednesday, August 29, 2001 1:21 PM
Subject: [Zope] String contains only digits


> Hi!
> 
> I have a form variable (select/option) which gives a number, or value
> "A".
> I have to check the value, is it contains only digits. I use in python
> script
> "if container.REQUEST.state in '0123456789'". Is there any other way to
> check?
> Because string object has neither "isdecimal", "isdigit" nor "isnumeric"
> method.
> I use zope 2.3.3 under Linux.
> 
>    Thanks:
> 
>     Lajos Kerekes
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )