Rob*_* Li 9 python python-3.x python-typing
memo: dict[int, int] = {0: 0, 1: 1} # *our base cases*
Run Code Online (Sandbox Code Playgroud)
返回以下错误:
memo: dict[int, int] = {0: 0, 1: 1} # *our base cases*
Run Code Online (Sandbox Code Playgroud)
Dav*_*izu 17
我想你应该使用Dict
,例如:
from typing import Dict
memo: Dict[int, int] = {0: 0, 1: 1}
Run Code Online (Sandbox Code Playgroud)
在您的情况下,您使用的dict
是哪种类型type
>>> type(dict)
<class 'type'>
>>> type(Dict)
<class 'typing._GenericAlias'>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7750 次 |
最近记录: |