标签:inpu error indexer cep exce username 变量 style 用不了
def func(): list = [] usr = input(‘username:‘) pwd = input(‘password:‘) try: list[4] # 这个是调用不了的,因为列表没有元素 except Exception as e: print(e.__class__) func()
username:11
password:1
<class ‘IndexError‘>
def func(): list = [] usr = input(‘username:‘) pwd = input(‘password:‘) try: name # 这个变量是没法收到的 except Exception as e: print(e.__class__) func()
username:1
password:1
<class ‘NameError‘>
标签:inpu error indexer cep exce username 变量 style 用不了
原文地址:https://www.cnblogs.com/apollo1616/p/9516879.html