pyhton学习笔记(更新中)

断断续续地学python,时不时玩一把。
记录一下要注意的问题,虽然简单,但一段时间不用就会手生,好记性不如烂笔头。

python写完不加分号

print

python2:print XXXX
python3:print (XXXX)

数字转字符串

str()

格式化输出

类似C,但要有百分号

strHello = "the length of (%s) is %d" %('Hello World',len('Hello World'))
print (strHello)

print会在末尾自动加上回车换行,在print末尾加上都好即可

print(i,)

猜你喜欢

转载自blog.csdn.net/yq_forever/article/details/80958355