在Python 3中,我想检查value是字符串还是字符串None.
value
None
一种方法是
assert type(value) in { str, NoneType }
但是NoneTypePython的位置在哪里?
NoneType
没有任何导入,使用NoneType产品NameError: name 'NoneType' is not defined.
NameError: name 'NoneType' is not defined
python types python-3.x nonetype
nonetype ×1
python ×1
python-3.x ×1
types ×1