函数的参数类型定义 参数定义类型的方法 def person(name:str, age:int=33): print(name, age) 函数定义在python3.7之后可用 函数不会对参数类型进行验证 代码 # coding:utf-8 def add(a: int, b: int = 3): print(a + b) add(1, 2) # add('hello', 'xiaomu') def test(a: int, b: int = 3, *args: in...
hn.icodeq.com1 min read
No responses yet.