python 格式化输出
2013-12-18 18:43
176 查看
string的格式化输出方式
第一种方式:format函数
a="hello world"format(a,"*^20")
输出:****hello world*****
第二种方式: %
'%-20s' % a或者 '%20s' % a第三种方式: ljust,rjust函数
>>> text.rjust(20,'=')'=========Hello World'
>>> text.center(20,'*')
'****Hello World*****'
'======================待续======================'
相关文章推荐
- Python 格式化输出占位符替换
- Python格式化输出
- python 3 用户输入和格式化输出
- Python格式化输出
- python格式化输出
- python 格式化输出
- python 输入语句以及格式化输出语句的使用
- python 格式化输出
- Python 格式化输出 ( 颜色 )
- python格式化输出
- Python format 格式化输出语法讲解
- python 格式化输出
- Python字符串格式化输出方法分析
- Python 格式化输出 —— 小数转化为百分数
- Python实现字符串格式化输出的方法详解
- Python进行JSON格式化输出
- Python格式化输出
- python format 格式化输出
- python 格式化输出 json 数据