0%

Python summary

Python 数据类型

  • Number, String, List, Tuple, Set, Dictionary
  • Immutable: Number, String, Tuple
  • Mutable: List, Set, Dictionary
  • Number: <class ‘int’> <class ‘float’> <class ‘bool’> <class ‘complex’>
  • String: 变量[头下标:尾下标] r’ds\n’(raw), “””…”””, b’’(byte)
  • None: not is 0
  • List: append(), pop(), retrieve[], o(1); insert(index, obj), pop(index), o(n)
  • Tuple: 不变的List, ()
  • Set: 不重复(a - b)差集, (a | b)并集, (a & b)交集, (a ^ b)不同时存在
  • Dictionary: k-y