Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下设置:
from typing import List a = List[int] foo(a) == int
我foo可以用什么来int摆脱List?
foo
int
List
您可以使用该属性__args__来取出int.
__args__
from typing import List a = List[int] print(a.__args__[0])
结果:<class 'int'>
<class 'int'>