用于用户自定义函数中的数据类型的信息,以字典形式存储在__annotations__属性中。
def testWords(name : str, count : int) -> str:
print(name + ' has ' + str(count) + ' eggs.')
testWords(name='lily', count=3)
# lily has 3 eggs.
用于用户自定义函数中的数据类型的信息,以字典形式存储在__annotations__属性中。
def testWords(name : str, count : int) -> str:
print(name + ' has ' + str(count) + ' eggs.')
testWords(name='lily', count=3)
# lily has 3 eggs.