python基础—-变量

变量

变量是一个容器,用于存储数据到内存,方便后面需要用到时直接调用变量的名称即可

 

变量规则

  1. 变量名只能是 字母、数字或下划线的任意组合
  2. 变量名的第一个字符不能是数字
  3. 以下关键字不能声明为变量名
  4. [‘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’]

 

变量赋值 

age = 18

name = “irene”