[Python Wpg] String to integer conversion

Bill Reid billreid at shaw.ca
Wed Mar 29 01:00:53 CEST 2006


Mike Pfaiffer wrote:

> Is there a simple way to check if the value of the string is numeric first or 
> better yet return zero if the value of the string contains alphabetic 
> characters?
> 

I did not look up a reference so there might be a better "python" way of doing 
it but you could using a reg expression match    ^[0-9]*$

-- Bill


More information about the Winnipeg mailing list