python之变量与赋值

2017-05-06 01:15

1 变量:

示例:

Python 2.6.6 (r266:84292, Jul 23 2015, 14:41:34) 

[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> name="zwj"                

>>> age=21

>>> name

'zwj'

>>> age

21

>>> name,age                            #调用变量方式1

('zwj', 21)

>>> a=10

>>> print(a)                            #调用变量方式2

10

>>> id(name)                            #查看变量name的内存地址

3077527360L

备注:字符串需要加双引号,而数字不需要。