python % format

python中%:

1. 求模运算,相当于mod,也就是计算除法的余数,比如5%2就得到1。

2. %还用在python的格式化输出,比如:
     a = 'test'
     print 'it is a %s' %(a)
     打印的结果就是 it is a test

本文章来自于python123的课件
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自www.cnblogs.com/sogeisetsu/p/11368811.html