Beginner: string to long

Dinu C. Gherman gherman at darwin.in-berlin.de
Tue Apr 18 13:01:07 CEST 2000


hudson_melville at my-deja.com wrote:
> 
> I'm a very beginner, and I have a program with
> nested loops that put numeric operators (+,-) in
> a string of numbers ('3564752617') The outputs
> are similar to '3564-752+617' How do I convert it
> so it can evaluate into a long integer? Is there
> a built-in that I don't know about that would do
> this?

eval('long(3564-752+617)')
3429L

Is this what you mean?

Dinu

-- 
Dinu C. Gherman
................................................................
"The thing about Linux or open software in general is that 
it actually tries to move software from being witchcraft to 
being a science," [...] "A lot of the programs you see today 
are actually put together by shamans, and you just take it and 
if the computer crashes you walk around it three times... and 
maybe it's OK." (Linus Thorvalds, LinuxWorld 2000, NYC)



More information about the Python-list mailing list