字符串格式在不同的环境中出现不同

发布于 2025-02-12 02:59:33 字数 684 浏览 0 评论 0原文

我正在尝试通过使用SlackBotapi将短信从Python发送到Slack。 我处理了这样的文字:(看起来很整洁)

我通过此代码行格式化字符串:

但是在Slackbot API发送此文本后,文本出现在Slack上:

我猜每个字符的宽度(包括空间)在松弛上有所不同,但在python提示中没有不同。 我如何能像python上的懈怠一样整洁地看到文字? 谢谢。

I'm trying to send text from python to slack by using slackbotAPI.
I processed text like this: (looks neat)
enter image description here

I formatted string by this code line:
enter image description here

But after sending this text by slackbot API, text appeared on slack like this:
enter image description here

I guess the width of each character(include space)is different on slack, but not on python prompt.
How can I see the text neatly on slack like on python?
Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

澉约 2025-02-19 02:59:33

我认为,实现您想要的最佳方法不是使用Tabs等文本字符,而是使用段块内部的字段

这将确保不管接口如何,它们都可以正确排列。

这是一个示例

”带有字段的松弛消息的屏幕截图”

I think the best way to achieve what you're looking for isn't with text characters like tabs etc, but to use fields inside a section block.

That will make sure that regardless of interface, they're arranged correctly.

Here's an example

Screenshot of a slack message with fields

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文