
March 9th, 2013, 09:46 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 5
Time spent in forums: 1 h 33 m 18 sec
Reputation Power: 0
|
|
|
Try except syntax error
Dear all,
I am new to python and trying to get a try...except part of a code to work but I always get an "invalid syntax" error
this part of the code should read 2 files and if the user does not include the 2 files in his command line the except message will appear saying "please enter 2 file names, they were not entered properly" and exits.
I am using Python 3.2
the code is:
Code:
import sys, math
try:
r=input("where is file1") ; z = input("where is file2?")
except:
print("please enter 2 file names, they were not entered properly"); sys.exit(1)
|