【问题标题】:how to format my discord python bot output?如何格式化我的不和谐 python 机器人输出?
【发布时间】:2021-05-12 18:11:48
【问题描述】:

我正在基于 python 代码制作一个 Disord 机器人。 python代码执行完美。但是当不和谐机器人调用程序时,它会破坏输出的格式/对齐方式。

我在 python 上使用制表来输出。感谢您为解决这个问题所做的任何帮助。

这是调用列表输出的制表代码

topgn=(tabulate(alist, headers='keys',tablefmt='pipe',numalign='left',stralign='center'))

还附上截图python output ss-discord bot ss

非常感谢

【问题讨论】:

  • 除非您以代码块的形式发送它,否则您将无法以正确的格式发送它

标签: python-3.x discord.py tabulate


【解决方案1】:

使用等宽字体。 Discord 对此有代码块,需要 3 个反引号。 所以你的代码是:

topgn = "```" + tabulate(alist, headers='keys',tablefmt='pipe',numalign='left',stralign='center') + "```"

【讨论】:

  • 非常感谢。有效。是否有任何其他不和谐的格式提示
  • @vieraaj Here 都是 Discord 中的样式。如果回答对您有帮助,请点击左侧的勾号。
猜你喜欢
  • 2021-10-30
  • 2021-05-27
  • 2021-07-15
  • 2021-03-29
  • 2021-07-11
  • 2021-03-25
  • 2018-08-13
  • 1970-01-01
  • 2021-02-28
相关资源
最近更新 更多