• 数据类型

    • 整数 int。a = 123; print(type(a)) # <class ‘int’>
    • 浮点数 float。 a = 1.23; print(type(a)) # <class ‘float’>
    • 字符串 str。a = ‘str’;#或 a = “str”; print(type(a)) #<class ‘str’>
    • 布尔型 bool。 a = True; print(type(a)); #<class ‘bool’>
  • 变量 弱引用,类型不固定;不同于Java固定的变量类型

    • a = 123; # a为整数 a = ‘123’; # a为字符串
  • 常量

    一般使用全大写字母变量名来表示常量,但实际上Python没法保证这种定义不会被更改,只是一种约定

    • PI = 3.1415926535