[Tutor] string to integer

Boyan R. boyanpn at yahoo.com
Thu Jan 5 21:40:10 CET 2006

I need program to convert my string in integer.
I remember in BASIC I used  val(string) command 
Is there a Python equivalent ?

Here is how it should work:
val(7) = 7
val(bbab7) = 7
val(aa7aa) = 7
val(   7) = 7  

This last is most important, currently I don't know how to
convert string "   7" to integer value 7 in my program
(those empty spaces are nasty)
btw, I'm working with random numbers, I took 7 just for example :)

Also, what are chr() values for enter and (empty) space ?
If anybody have a table with chr() values, I'd appreciate
if he upload it somewhere. Thanks in advance !

More information about the Tutor mailing list