Python3学习之路(3)变量
变量
#!/usr/bin/env python
name = "erbiao"
变量定义的规则:
----1、变量名只能是字母、数字或下划线的任意组合
----2、变量名的第一个字符不能是数字
----3、以下内置关键字不能声明为变量名['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']
变量在输出时,不要用引号引起,否则Python会将其解释为字符串
>>> a=2
>>> print (a)
2
>>> print ('a')
a

浙公网安备 33010602011771号