为什么电报的响应带有unicode?

时间:2019-06-03 14:06:29

标签: python python-3.x python-requests telegram telegram-bot

例如:

r = requests.post(config['send_photo_method'], data={'chat_id':config['chat_id'], 'caption': msg_to_send}, files={"photo":get_media_blob(driver, get_img_blob(driver))})
print(r.text)

输出:

{"ok":true,"result":{"message_id":424,"from":{"id":710795082,"is_bot":true,"first_name":
                     "\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438\u0437

我该如何解决?

1 个答案:

答案 0 :(得分:1)

如果您使用的是python3.x(假设您写的是print()而不是print),请使用r.json()而不是r.text获取响应内容。