這個問題在這里已經有了答案: 如何在 Python 中對查詢字串進行 urlencode? (14 個回答) 2 小時前關閉。
我試影像往常一樣發出命令,但我不能在它們之間使用空格。這是我目前的代碼。
@client.command()
async def cautionsign(ctx, msg):
embed = discord.Embed(title="Here's your caution sign!")
embed.set_image(url=f"https://api.popcat.xyz/caution?text={msg}")
await ctx.send(embed=embed)
例如,如果我使用
!cautionsign 測驗
它會顯示一個帶有測驗的警告標志,但如果我使用
!cautionsign test test
它只會顯示測驗。
如果有人可以幫助我,我將不勝感激:)
uj5u.com熱心網友回復:
嘗試使用urllib.parse.quote正確轉義 url 組件。例如...
from urllib.parse import quote
embed.set_image(url=f"https://api.popcat.xyz/caution?text={quote(msg)}")
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/492958.html
標籤:Python python-3.x 不和谐 不和谐.py
上一篇:ValueError:形狀(784,32)和(10,784)未對齊:32(dim1)!=10(dim0)對于神經網路
