【发布时间】:2022-11-04 19:53:16
【问题描述】:
如果在邮递员中复制/粘贴打印,则有效!但在 Python 中给出错误
这是我的代码
array = '{"chat_id": "' + chat_id + '", "text": "Test Buttons", "reply_markup" : { "inline_keyboard" : [[ { "text" : "web", "url" :"google.es"}]]}}'
data3 = json.loads(array)
print(array)
url = f'https://api.telegram.org/bot{token}/sendMessage'
response = requests.get(url, params=data3)
print(response.json())
错误是
{'ok': False, 'error_code': 400, 'description': "Bad Request: can't parse reply keyboard markup JSON object"}
印刷品是
{"chat_id": "123XXX", "text": "Test Buttons", "reply_markup" : { "inline_keyboard" : [[ { "text" : "web", "url" :"google.es"}]]}}
【问题讨论】:
-
您可能希望使用三个反引号“ ``` ”以便以易于理解的方式表示您的代码。