python - Gratient 模块如何在同一行打印文本
问题描述
我正在尝试使用 gratient 模块,但我需要帮助
当我设置此代码时:
import gratient
a = gratient.green("[1]")
ab = gratient.red("Private Tool")
print(a, ab)
上面的代码打印文本但在不同的行,我怎样才能在同一行打印它?
解决方案
尝试这个:
import gratient
a = gratient.green("[1]")
ab = gratient.red("Private Tool")
print((a + ab).replace("\n", " "))
如果您在 a 或 ab 中有专用的 \n,则此答案无效
推荐阅读
- r - 从因子日期时间中提取时间范围 - R
- r - 使用 R 重命名文件并保存新旧文件名的日志
- google-maps - Google Maps API - 将任意数据添加到数据层中的点
- ffmpeg - 使用 ffmpeg 在不改变频率的情况下对音频进行时间膨胀和重新采样
- python - MS Word 使用 COM 接口更改当前选定的功能区项目
- nginx - nginx 显示 vhost 而不是默认 root
- javascript - 如何查找 Google Drive 文件的父文件夹的整个层次结构?
- ios - Metal View (MTKView) 图纸尺寸问题
- material-ui - 负边距的网格(顶部)破坏了我的 UI
- http - java 8升级后http调用的URI不能为空异常