<p>在我当前的discord机器人中,我希望我的程序以相同的格式输出所有内容:</p>
<pre class="lang-py prettyprint-override"><code>@client.command()
async def audios(ctx):
# audio is a link from a list of links i have stored in all_audios
audio = random.choice(all_audios)
audiostr = str(audio)
# this queries a part of the link
output = PurePosixPath(
unquote(
urlparse(audiostr).path
)
).parts[1]
actualoutput = str(output)
await ctx.send("`credits to `" + actualoutput + "\n" + audio)
</code></pre>
<p>是否可以使<code>actualoutput</code>格式为反勾号<code> </code>?
当我通过discord运行这个命令时,它返回</p>
<p><code>credits to</code>文本</p>
<p><a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a></p>
<p>我希望它能以同样的方式返回</p>
<p><code>credits to text</code></p>
<p><a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a></p>
<p>一切都很好,我只是希望格式都匹配。先谢谢你</p>