python——內建型別——整型 浮點型 字串 布林型 空型
阿新 • • 發佈:2019-02-15
整型
- 十進位制:123,456
- 八進位制:0123,0456
- 十六進位制:0x7abc,0X8def
浮點型
- 十進位制(必須包含小數點):123.456,.123,123.
- 科學計數法(e或E前後必須有值):123e3,4.56E6,.789e9
字串
- 用單引號或雙引號包括,但不可混搭使用
- 多個字串拼接
- 支援轉義
- 字首r:字串內不轉義
- '''...''':字串跨行表示
output: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"
1:first,second,third
2:first,second,third
3:first,
second,
third
4:first,\nsecond,\nthird
5:first,
second,
third
6:first,
second,
third,fourth,fifth
布林型
- True
- False
空型
- None,類似於java的null,oc的nil