nums: List[int]:注释这个变量是列表。 变量:注释 :这种写法是对变量类型进行注释def twoSum(self, nums: List[int], target: int) -> List[int]: def 方法名() -> 注释。这种写法是对方法的返回值类型进行注释
-> List[int]为了说明参数和返回值的数据类型,方便开发人员使用。