django - Try / except syntax in Python with two of the same exceptions -
i checking emails against 2 lists -- list of domains , list of individual emails. how construct following try statement --
try: 'email in email_list' except doesnotexist: 'domain in domain list' # if email not found except doesnotexist: 'print error message' # if both email , domain not found
what syntax need use construct statement?
it sounds you're looking like:
if email in email_list: # email elif domain in domain_list: # domain else: print "neither email nor domain found"
there no need exceptions in case.
Comments
Post a Comment