class MyException(Exception):
pass
try:
sex = input("Please enter your gender:")
if sex != "male" and sex != "female":
raise MyException("only male or female !")
except MyException as e:
# print(e)
logging.debug("第19行有错误:{}".format(e))
except Exception as e:
print(e)
finally:
print("Over!")
logging.debug("this is a debug log !")
logging.info("this is a info log !")
logging.warning("this is a warning log !")
logging.error("this is a error log !")
logging.critical("this is a critical log !")