python 获取exception 名字

2021-07-20 19:06

阅读:630

标签: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

def func():
    list = []
    usr = input(username:)
    pwd = input(password:)
    try:
        name # 这个变量是没法收到的
    except Exception as e:
        print(e.__class__)
func()

username:1
password:1

python 获取exception 名字

标签:inpu   error   indexer   cep   exce   username   变量   style   用不了   

原文地址:https://www.cnblogs.com/apollo1616/p/9516879.html


评论


亲,登录后才可以留言!