python中字符串的ljust、rjust、center方法讲解
来源:互联网 发布:淘宝哪家韩国代购是正品 编辑:程序博客网 时间:2024/05/19 11:48
这三种方法的用法差不多:S.ljust(width[, fillchar]),即长度加占位符,默认为空格,这三种在格式化输出时用着非常方便。
>>> a="Hello world">>> print a.rjust(20)' Hello world'>>> print a.ljust(20)'Hello world '>>> print a.center(20)' Hello world '>>> print a.rjust(20,'*')'*********Hello world'>>> print a.ljust(20,'*')'Hello world*********'>>> print a.center(20,'*')'****Hello world*****'
转载自:http://wangwei007.blog.51cto.com/68019/1242076
阅读全文
0 0
- python中字符串的ljust、rjust、center方法讲解
- python中字符串的ljust、rjust、center方法讲解
- python: center、ljust、rjust 函数
- python 字符串创建,遍历,切片,格式化ljust rjust center,find,replace,split,repr,str
- python(5)---center,ljust,rjust功能实现小函数
- Pandas 文本数据方法 pad( ) center( ) ljust() rjust() zfill()
- python 4-5 如何对字符串进行左, 右, 居中对齐str.ljust/rjust/center/format(s,'<20'/'>20'/'^20')
- python中ljust填充包含中英文字符串问
- python日积月累之ljust()
- Python中字符串的方法
- python字符串内建函数方法讲解
- python中字符串方法
- python中字符串的一些琐碎方法
- python中字符串的常用方法
- Python中有效的字符串合并方法
- Python去掉字符串中空格的方法
- Python中有效的字符串合并方法
- Python去掉字符串中空格的方法
- 浅谈jsp、freemarker、velocity区别
- 利用Android Studio构建App
- iOS开发(OC)——音视频播放
- Sublime3 PackageControl安装问题
- Codeforces Round #433 (Div. 2) B.Maxim Buys an Apartment(找规律+技巧)
- python中字符串的ljust、rjust、center方法讲解
- Java中关于File的操作
- java的环境搭建
- Andoird自定义控件_弧度表盘
- 单滑块控件代码
- JSON解析之NSJSONSerialization
- android 判断当前应用是否与服务器连接成功
- python查看pydoc
- JavaEE面试题