为什么来自电报的响应带有 unicode?
Why does the response from telegrams come with unicode?
例如:
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
我该如何解决这个问题?
如果您使用 python3.x
(假设您写的是 print()
而不是 print
),请使用 r.json()
而不是 r.text
获取响应内容].
例如:
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
我该如何解决这个问题?
如果您使用 python3.x
(假设您写的是 print()
而不是 print
),请使用 r.json()
而不是 r.text
获取响应内容].