陪玖情感
您的当前位置:首页python中%是什么意思

python中%是什么意思

来源:陪玖情感


python中%是什么意思?

python中%:

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

2. %还用在python的格式化输出,比如:

a = 'test'
print 'it is a %s' %(a)

打印的结果就是 it is a test

显示全文