python 获取异常类型

import json


def austin():
    try:
        json_data = ""
        json.loads(json_data)
    except Exception as e:
        print repr(e)


if __name__ == '__main__':
    austin()

 

输出结果:ValueError('No JSON object could be decoded',)

你可能感兴趣的:(python)