Printing user input?

J. Clifford Dyer jcd at sdf.lonestar.org
Thu Nov 15 13:20:15 EST 2007


On Thu, Nov 15, 2007 at 09:03:26AM -0800, Mohammed_M wrote regarding Printing user input?:
> 
> Hi,
> I'm v.new to Python, so please don't be too harsh :)
> I get a NameError with the code below - All I want to do is store some
> input taken from the user in a variable called name, & then print name
> 
> # START CODE ==========================================
> # Print name demo
> 
> 
> def PersonsDetails():
>     name = input("What's your name?")
> PersonsDetails()
> 
> print(name)
> 
> 
> # END CODE ==========================================
> 
> Thanks for reading & any help on this
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Also,  you'll want to use raw_input() instead of input.

Cheers,
Cliff



More information about the Python-list mailing list