摘要:
from dataclasses import dataclass @dataclass class A: def print(self): x.append(2) print(x) @dataclass class B: def print(self): print(x) x = [1] kwar 阅读全文
摘要:
测试一: for i in [0, '', [], {}, ()]: a = i if a: print('a') 输出: 测试二: for i in [2, 'a', [1,2,3], {'a':'a'}, (1,2)]: a = i if a: print('a') 输出:'a' 'a' 'a' 阅读全文