ATscore

  • 首页
  • 听音乐
  • 科普
  • 冒险岛
  • 声明
  • 关于
  1. 首页
  2. 信息技术
  3. 正文

python3 中英文混输的对齐问题

2022年1月14日 916点热度 1人点赞 1条评论

file

使用wcwidth这个模块

from wcwidth import wcswidth as wcs
def print_fix_width(s, n=20):
    k = wcs(s) - len(s)
    print(s.ljust(n-k," "), flush="")

参考文档

wcwidth的文档页 https://pypi.org/project/wcwidth/

Post Views: 911
标签: 暂无
最后更新:2023年4月27日

ATscore

用常识解读世界,用自己的大脑独立思考

点赞
< 上一篇
下一篇 >

文章评论

  • aladdin99apk

    Downloading the official app here was a breeze and the registration process took just seconds. I really appreciate how smoothly the slots run on my mobile device without any lag. Customer support responded quickly when I had a question about my welcome bonus. Give this platform a try and you will see why regular players keep coming back. <a href='https://aladdin99apk.org'>aladdin99apk</a&gt;

    2026年9月12日
    回复
  • 取消回复

    COPYRIGHT © 2022 atscore.cc. ALL RIGHTS RESERVED.

    THEME KRATOS MADE BY VTROIS