![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
windy布兰
这个作者很懒,什么都没留下…
展开
-
Python 一般的print()格式化输出
@[TOC](Python print()格式化输出) %s 字符串 (采用str()的显示) %r 字符串 (采用repr()的显示) %c 单个字符 %b 二进制整数 %d 十进制整数 %i 十进制整数 %o 八进制整数 %x 十六进制整数 %e 指数 (基底写为e) %E 指数 (基底写为E) %f 浮点数 %F 浮点数,与上相同 %g 指数(e)_x0010_或浮点数 (根据显示长度) %G 指数(E)或浮点数 (根原创 2020-08-15 21:22:41 · 749 阅读 · 0 评论 -
Python format() 格式化输出从基本到进阶
format()格式化输出 基本用法 不带编号,即“{}” 带数字编号,可以调换顺序,即“{1}”,“{2}” 带关键字,即“{a}”,“{tom}” >>> print('{} {}'.format('hello','world')) # 不带字段 hello world >>> print('{0} {1}'.format('hello','world')) # 带数字编 hello world >>> print('{0} {1} {0}'原创 2020-08-13 10:02:24 · 223 阅读 · 0 评论