python学习(1)变量

变量的申明

#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
name = "sage"

变量的作用:昵称,其代指内存里某个地址中保存的内容

变量定义的规则:

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

猜你喜欢

转载自www.cnblogs.com/sage914/p/11571963.html