【问题标题】:Python printing tabular data breaks with Google fontsPython 打印表格数据使用 Google 字体中断
【发布时间】:2022-01-08 01:10:46
【问题描述】:

我正在使用 Tabulate 包以表格格式打印数据。输出被发送到网页。使用默认字体时,一切正常。但是,在更改字体系列(例如来自 Google 字体或草书的服装)时,它们会停止对齐。有没有可能的解决方案?

使用默认字体输出:

Strength: 16             Dmg: 50         Armor: 3.8      ShadowRes: 3.5%
Agility: 34              Spell: 183      FireRes: 5.1%   NatureRes: 6.1%
Intellect: 61            Critical: 3.4%  FrostRes: 6.3%  ArcaneRes: 3.8%

使用 Google 字体输出(看起来无法真正显示,因为 SO 字体是默认字体):

Strength: 25               Dmg: 45         Armor: 3.1      ShadowRes: 3.2%
Agility: 20              Spell: 132    FireRes: 3.3%   NatureRes: 3.6%
Intellect: 44             Critical: 2.0%  FrostRes: 3.6%  ArcaneRes: 3.8%

提前致谢!

【问题讨论】:

    标签: python-3.x google-fonts tabulate


    【解决方案1】:

    您需要等宽字体以保持良好的空间大小

    【讨论】:

      猜你喜欢
      • 2019-05-09
      • 2011-07-04
      • 2012-04-28
      • 2020-09-08
      • 2021-10-13
      • 2022-01-12
      • 2011-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多