在我当前的discord机器人中,我希望我的程序以相同的格式输出所有内容:
@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)
是否可以使actualoutput
格式为反勾号?
当我通过discord运行这个命令时,它返回
credits to
文本
我希望它能以同样的方式返回
credits to text
一切都很好,我只是希望格式都匹配。先谢谢你
我误解了这个问题。如果您也希望
actualoutput
上的格式,可以将反勾号移到末尾因此,应该是:
结果是:
credits to <actualoutput>
在换行符之前,将结束回勾移动到字符串的末尾,如下所示:
相关问题 更多 >
编程相关推荐