[Tutor] Need help with Hello World (Laughing in the background)
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Mon, 28 Jan 2002 14:54:28 -0800 (PST)
On Mon, 28 Jan 2002, James M Lang wrote:
> OK, I've got Windows Python 2.2 on a Celeron 700mhz computer. I run the IDLE and put in Hello, World! I save it as hello.py on the desktop and then say run script from the edit menu. It says
> File "C:/WINDOWS/Desktop/hello.py", line 1
> Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
> ^
> SyntaxError: invalid syntax
> So, the question is, what's wrong with it?
Ah! You don't need to literally put in that particular line in your file
--- that's just information that Python spits out when we're running in
interactive mode. All your file needs to contain are the program
statements, like
###
print "Hello world"
###
So if you do a copy/paste from your interpreter to a separate file, you'll
need to do some quick editing to get rid of the decorations that the
interactive interpreter uses. Here's a page that has an example of this:
http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro
If you have more questions, please feel free to ask.