L = ["Adam", 95.5, "Lisa", 85, "Bart", 59]
print L
print L
2016-08-12
a = 'python'
print 'hello,', a or 'world'
结果为 hello world 。因为Python中非空字符值为True,所以此处a为TRUE。又因为短路计算,取决于另一值,所以出现 world.
print 'hello,', a or 'world'
结果为 hello world 。因为Python中非空字符值为True,所以此处a为TRUE。又因为短路计算,取决于另一值,所以出现 world.
2016-08-12
print z+':'+d[z] 注意连接号,这样写会报错
TypeError: cannot concatenate 'str' and 'int' objects
TypeError: cannot concatenate 'str' and 'int' objects
2016-08-12