str | None syntax is only supported in 3.10 or later. Use from typing import Optional name: Optional[str] = None For cases where the right hand side isn't None or there are more than two types, you can use Union from typing import Union foo: Union[str, int, float] = "bar"
标签:None,TypeError,Union,unsupported,str,operand,type From: https://www.cnblogs.com/a00ium/p/17738647.html