On 7/17/2009 9:43 AM keith...@beyondbb.com said...
Hi, I am reading values from a form and writing them to a text file. I keep getting
a syntax error for outfile=open("filename", "a")I cant see it, does any body else.
There isn't an error in the statement. Try to pare down your code to a
short example that causes the error. Then post the actual error and
code segment. It's more likely there's an unfinished something before
this line...
Emile
fileName = "requests.txt"
# Create instance of FieldStorage
Form = cgi.FieldStorage()
# Get data from fields
if Form and Form['submit'].value == "Submit":
the_name = Form.getvalue('name')
the_email = Form.getvalue('email')
the_address = Form.getvalue('address')
the_telephone = Form.getvalue('telephone')
IpAddress = cgi.escape(os.environ["REMOTE_ADDR"]);
Time = "(time.localtime()):", time.asctime(time.localtime())
entry = name + '|' + email + '|' + address + '|' + telephone + '|' +
IpAddress + '|' + Time + "\n"
outfile=open("fileName", "a")
outfile.write(entry)
outfile.close()
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor