NameError: name 'List' is not defined

后端 未结 3 862
情深已故
情深已故 2020-12-29 18:01

I\'m really unsure why this isn\'t working. Here is the important part of the code (it\'s from a leetcode challenge). The first line throws the NameError.



        
3条回答
  •  梦毁少年i
    2020-12-29 18:40

    To be able to specify a list of str's in a type hint, you can use the typing package, and from typing import List (capitalized, not to be confused with the built-in list)

提交回复
热议问题