首页 > TAG信息列表 > 妙事

Python 的那些妙事

python 动态创建类 type('Hello', (object,), dict()) set 集合 & 交集 | 并集 ^ 补集 - 差集 built-in 函数 breakpoint() 相当于pdb断点 divmod() divmod(4,2) # (2,0) divmod(x,y) 可代替 (x//y, x%y) iter() 迭代器妙用 itr = iter('abcd') if 'c' in itr: print