2019-03-11
阅读量:
567
分区运算符“//”在python2.7和3.0中的区别
在python2.7中,“//”运算操作如下:
# "//" for both integers and floating points
print 5//2
print -5//2
print 5.0//2
print -5.0//2
输出:
2
-3
2.0
-3.0
在Python 3中,'/'运算符为int和float参数执行浮点除法。
# A Python 3 program to demonstrate use of
# "/" for both integers and floating points
print (5/2)
print (-5/2)
print (5.0/2)
print (-5.0/2)






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论