Newbie question

Sarcar, Shourya C (MED) Shourya.Sarcar at med.ge.com
Sun Dec 23 20:31:43 EST 2001


Add to the first line
#!/usr/bin/python

OR

Run the script as
bash $ python fileTest.py

Dear Allan,
	You are running a python cript from the BASH shell. SO bash must
somehow know that a Python interpreter is to be used.
In the first way, you specify the program which is to be used to run the
script directly inside the script. In the second way, you give the
program as an "input" to the python interpreter


shourya
________________________________________________________________________
Shourya Sarcar | EEDP | Computer Technology Team, Global Software
Platforms
GE Medical Systems, 3200 N. Grandview Blvd., MS-WT 881, Waukesha, WI
53188
Tel:(262) 521 6295 Fax:(262) 521 6800 DC: *320 6295
 





-----Original Message-----
From: Peak Allan [mailto:apeak_2000 at yahoo.com]
Sent: Sunday, December 23, 2001 5:33 PM
To: python-list at python.org
Subject: Newbie question


I copied this code from one of the tutorials on the
python.org website, but when I tried to run it, I got
an error.

# Program FileTest

out_file = open("test.txt", "w")
out_file.write("This crap is going to out file\n")
out_file.close()

in_file = open("test.txt", "r")
text = in_file.read()
in_file.close()
print text

bash-2.05$ ./fileTest.py
./fileTest.py: line 3: syntax error near unexpected
token `open("'
./fileTest.py: line 3: `out_file = open("test.txt",
"w")'

Can someone please tell me what I did wrong?

Also, are the tutorials at python.org a good way to
learn Python?  If not, are there any other good online resources?

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list