我写了下面的代码来找到*args的继承。但我有一个错误。我真的不明白这个错误,因为我有输入,但他们不是没有。
def third(*args, option=True):
if len(args) == 2:
word1, word2 = args
else:
word1 = args[0]
if option:
return word1, word2
else:
return word1
def hello(data, *args, option=True):
print("the data is:", data)
A, B = third(*args, option=True)
print("the args are:", A, B)
def world(small, *args, option=True):
return hello(small, *args)
if __name__ == "main":
world("data","prediction")
输出:
the data is: data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in world
File "<stdin>", line 3, in hello
TypeError: 'NoneType' object is not iterable
斯蒂芬大帝
肥皂起泡泡
相关分类