[Tutor] String and integer

Jens Frid jens.frid at gmail.com
Mon Oct 20 23:24:53 CEST 2008


Hi,the code is:

def nr():
    nr1 = input('Enter value: ')
    print str(nr1).strip('nr0')

The user input is always on the form "nr08756" and i'd like to take out the
"nr0" and then print the result.
I can see that there is a problem with a variable looking like "pn0123"
because i get:
NameError: global name 'nr0123' is not defined.

What is the right way to do this?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081020/764a35f0/attachment.htm>


More information about the Tutor mailing list