当前位置:   article > 正文

python向右对齐_各位大神,这个输出如何每列左对齐?

python文本每行右对齐怎么弄

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

Python 3.6.2 (default, Apr 25 2018, 09:37:02)

[GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> dir(str) ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

>>> help(str.ljust)

Help on method_descriptor:

ljust(...)

S.ljust(width[, fillchar]) -> str

Return S left-justified in a Unicode string of length width. Padding is

done using the specified fill character (default is a space).

>>> 'fff'.ljust(18,' ')

'fff '

>>>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/294536
推荐阅读
相关标签
  

闽ICP备14008679号