带有特定cod的Python Catch错误

2024-06-28 20:08:14 发布

您现在位置:Python中文网/ 问答频道 /正文

在代码中我有这个错误

raise ClientError(response_data['data']['error'], response.status_code)
ClientError: (300) corrupt or not supported.

如何捕捉错误300?你知道吗

try:
    somestuff

except ClientError:
    if error = 300:  # ?????
        print 'catched'
    else:
        just end the program

谢谢你的帮助。你知道吗


Tags: or代码dataresponsestatus错误notcode