python //、/、%

python2中的地板除/,是取整数位。

3/2=1

3/2.0=1.5

在pyhon3中/是真除法。

3/2=1.5

如果想在python3使用地板除,是//

3//2=1

%表示求余数

5%2=1

猜你喜欢

转载自blog.csdn.net/qq_26529803/article/details/81163165