python中%代表什么意思?

python中%:

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

  2. %还用在python的格式化输出,比如:
         a = ‘test’
         print ‘it is a %s’ %(a)
         打印的结果就是 it is a test
    ————————————————
    版权声明:本文为CSDN博主「liuyhoo」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/liuyhoo/article/details/80885254

猜你喜欢

转载自blog.csdn.net/Love_Polaris/article/details/102841651
今日推荐