如何在Python中打印粗体文本?
例如:
print "hello"
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能使文本"hello"以粗体显示?
我试过这个
elif command == 'bold':
telegram_bot.sendMessage (chat_id, str("*bold*"), reply_markup=markup)
Run Code Online (Sandbox Code Playgroud)
但它是回复*bold*而不是粗体
我想使用本机 Python 请求发送Telegram消息,以便在使用BOLD时收到“名字” 。我尝试过 HTML 和 Markdown 语法,但没有显示。
import json
import requests
# Telegram bot configurations
TELE_TOKEN='TOKEN'
URL = "https://api.telegram.org/bot{}/".format(TELE_TOKEN)
def send_message(text, chat_id):
url = URL + "sendMessage?text={}&chat_id={}".format(text, chat_id)
requests.get(url)
# AWS Lambda handler
def lambda_handler(event, context):
message = json.loads(event['body'])
chat_id = message['message']['chat']['id']
first_name = message['message']['chat']['first_name']
text = message['message']['text']
# How can the first name be in BOLD?
reply = "Hello " + first_name + "! You have said:" + text
send_message(reply, chat_id)
return {
'statusCode': 200 …Run Code Online (Sandbox Code Playgroud)