I'm getting the following error:
File "Question2.py", line 18
except getopt.GetoptError as e:
SyntaxError: invalid syntax
Section of code that it comes from:
try:
opts, args = getopt.getopt(argv, "c:t:", ["class=","term="]
except getopt.GetoptError as e:
print 'Question2.py -c <class> -t <term>'
system.exit(2)
for opt, arg in opts:
if opt in ('c', 'class'):
selectclass = arg
if opt in ('t', 'term'):
selectterm = arg
What I am trying to do is get command line arguments working. I want to be able to accept -c or -class and -t or -term. I am following a tutorial located here. I am unsure what is going wrong.
)on previous line.