python——内置类型——整型 浮点型 字符串 布尔型 空型

来源:互联网 发布:mysql的url参数详解 编辑:程序博客网 时间:2024/05/29 14:22

整型

  • 十进制:123,456
  • 八进制:0123,0456
  • 十六进制:0x7abc,0X8def

浮点型

  • 十进制(必须包含小数点):123.456,.123,123.
  • 科学计数法(e或E前后必须有值):123e3,4.56E6,.789e9

字符串

  • 用单引号或双引号包括,但不可混搭使用
  • 多个字符串拼接
  • 支持转义
  • 前缀r:字符串内不转义
  • '''...''':字符串跨行表示
print '1:first,second,third'print '2:first,'"second,"'third'print '3:first,\nsecond,\nthird' print r'4:first,\nsecond,\nthird'  print '''5:first,second,third'''print '''6:first,second,third,''''fourth,'"fifth"
output:
1:first,second,third2:first,second,third3:first,second,third4:first,\nsecond,\nthird5:first,second,third6:first,second,third,fourth,fifth

布尔型

  • True
  • False

空型

  • None,类似于java的null,oc的nil
0 0
原创粉丝点击