Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Windows Python Interpreter: Initializing vars

Status
Not open for further replies.

JonV

Technical User
Aug 31, 2001
1
0
0
GB
I am not really a programmer. I am currently learning python on windows, but I have a small problem using the GUI interpreter. When I run a program such as this:

a = input("What is your name? ")
print "Your name is",a

I am unable to initialize the variable with a string. I type something, press [ENTER] and it just goes on to a new line, like a normal text editor type thing would do. It does not print the second line on the screen. I am also unsure how to open files in the DOS interpreter, so I have been unable to try it there.

Knowing me, it is probably something completely obvious that I have overlooked. If you help me out here, I will be very happy!
 
Try the following :

a = raw_input("What is your name? ")
print "Your name is",a

I am just starting out in programming as well - so I may not have given you the best possible answer.

I use Josh's tutorial guide which can be found at
Hope this helps. JP
 
Why do you work with input and don't assign a directly the string value?

To open files in the DOS Interpreter you have to change in your Python path and type:
python.exe and then the py-file you wan't to execute.
Or set your PythonPath to the directory.
I suggest also you to accommodate your PATHEXT.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top