python--typing模块


不清楚函数参数类型或者返回值类型,可以使用typing模块(python3.5以上版本适用)

常用类型:

整型、长整形、浮点型:int、long、float
布尔型、字符串类型: bool、str
列表、元组、字典、集合:List、Tuple、Dict、Set
可迭代类型、迭代器类型:Iterable、Iterator
Generator:生成器类型

常用方式:

from typing import List, Tuple, Dict

def test_(a: int, string: str, x: 

猜你喜欢

转载自blog.csdn.net/BLee_0123/article/details/129980498
今日推荐