6、print 输出和pass关键字

print-Python

不具有自动数据转换的功能,“+”只能连接相同数据类型
java中string + 基本数据类型,基本数据类型的数据能自动转换成string数据类型

print(“hello {} world {} “.format(x,y))
print(“hello”+str(x)+”world”+str(y))

pass和continue的区别

pass相当于占位符,不具有任何实际意义

while True:
    pass

其中pass没有任何实际意义,只是Python不能识别空白,所以pass只是充当while的实体的作用,实际没有任何意义

continue是跳出本次循环,cuntinue下的语句不执行,直接返回到判断部分

猜你喜欢

转载自www.cnblogs.com/Stephanie-boke/p/11711321.html
今日推荐