Newbie Question - String Input

Sonic Hedgehog celtic at ix.net.au
Sun Sep 3 01:11:26 EDT 2000


I am using Python on a Wintel machine and I am trying to get Python to
accept string data.  In the following program (a very basic program)
Python accepts numerical data without any problems but will not accept
any string data at all - the program crashes with the following error:

	Traceback (innermost last):
		File "hello.py", line9, in ?
			userName=input("What is your name? ")
		File "<string>", in line 0, in ?
	NameError: whatever_I_Entered

Would someone please tell me what it is that I am doing wrong.  I am
sure it is a rather simple to rectify.

And if someone knows of any websites that have good tutorials for
Python please email me with the addresses.

A big thankyou in advance to anyone that can help.

Regards,
-----------------------------------------------------------------
Vaughan Egan   ---   celtic at ix.net.au   
-----------------------------------------------------------------


#! python
print "Hello World!\n"
print "~~~~~~~~~~~~\n"
print "and welcome to Python Programming"


number = input("Enter a number? ")
print "Your number was: ",number

userName = input("What is your name? ")
print "Hello ",userName





More information about the Python-list mailing list