【发布时间】:2021-12-27 10:19:29
【问题描述】:
在下面的代码中,它说它不能附加“a”,因为它是 NoneType 类,但就在该行之前,它能够打印列表并打印其类型。为什么下一行会丢失类型?
from itertools import combinations_with_replacement
def output_list_of_feature_names(degree, list_of_feature_names):
a = ["as", "asd"]
for i in range(1, degree + 1):
for item in combinations_with_replacement(list_of_feature_names, r = i):
print(a)
print(type(a))
print(a)
a = a.append(item)
return a
output_list_of_feature_names(2, ["throttle", "angle", "final_vert_speed"])
【问题讨论】:
标签: python