Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu 12.04 and just installed python 3.2.3 tried to save and run the "hello world program". But it will not run I keep getting a syntax error. How do you run a program in python ????.

share|improve this question

closed as unclear what you're asking by Eric Carvalho, Thomas W., Jorge Castro, Seth, hexafraction Jul 8 '13 at 2:17

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
This question appears to be off-topic because it is about programming, try stackoverflow.com –  Jorge Castro Jul 7 '13 at 18:29

2 Answers 2

To run a Python file, open a terminal and type: python /directory/to/file.py.

You can also make Python files executable without having to run them from the terminal but I prefer this approach, it allows for such errors to be displayed.

To return a print vaule in Python 3.2.3 use the syntax: print("Hello, world!")

Or

helloWorld = "Hello, World!"

print(helloWorld)
share|improve this answer

Taking a complete guess, since you didn't provide any code, you're trying to run:

print "Hello, world!"

Had you looked at a reference for Python 3 written in the past, oh, 3 years or so, you would've known that print is a function in Python 3.

print("Hello, world!")
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.