Jens Frid wrote:
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?
raw_input() rather than input(). input evaluate whatever is entered;
raw_input returns as a string whatever is entered.
In Python 3 raw_input will be renamed input and the old input will go away.
Thanks!
------------------------------------------------------------------------
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware of our feelings and
needs we have more satisfying interatctions with others.
Nonviolent Communication provides tools for this awareness.
As a coach and trainer I can assist you in learning this process.
What is YOUR biggest relationship challenge?
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor