变量

变量名 = 值

变量名自定义,需要满足命名规则

标识符

  • 与C语言标准一致

  • 不能使用关键字

  • 关键字如下

    1. False None True and as assert break class
    2. continue def del elif else except finally for
    3. from global if import in is lambda nonlocal
    4. not or pass raise return try while with
    5. yield

命名习惯

  • 见名知意
  • 大驼峰
  • 小驼峰
  • 下划线
  1. myName = 'Phil'
  2. print(myName)
  3. my_school = "CCU"
  4. print(my_school)
  5. MySex = "Male"
  6. print(MySex)