print "age: ", 21
#打印元组时必须加上括号
print 1, 2, 3
print (1, 2, 3)
有以下四中导入形式:
#为模块提供别名(as子语句)
import math as foobar
foobar.sqrt(4)
#为函数提供别名(as子语句)
from math import sqrt as foobar
foobar(4)
#多个变量同时赋值
x, y, z = 1, 2, 3
#python交换变量的值非常简单!!!
print x, y
x, y = y ,x
print x, y
#这个特性允许函数或者方法返回多个值
#此时等号左右两边的量的数要相等,而且对应正确
pbook = {'Zk': '510', 'Zps' : '877'}
key, value = pbook.popitem()
print key , value
x = y = 3
print x, y
s = "Hello,"
s += "world!"
s *= 2
s