Reputation: 2458
I have a html file with and a separate python file. I am looking for a formdata value with a specific id. My form in the html file is correct and works in Python 2. In Python 2 the code is as follow, what can be the code in Python3 because I get the else error catch "op not found"
Import cgi
formdata = cgi.FieldStorage()
def main():
if formdata.has_key("op"):
op = formdata['op'].value
else:
print "op not found"
show()
sys.exit(1)
Thank you!
Upvotes: 1
Views: 3248
Reputation: 5202
The else block shouldn't be executed at all, in Python 3 has_key
has been removed. Use in
instead.
Upvotes: 2