gpt4 book ai didi

python : no output or only an empty list was produced

转载 作者:太空宇宙 更新时间:2023-11-04 05:58:22 24 4
gpt4 key购买 nike

index1 = 0
singlechar = []
def SINGLE_CHAR_VAR(filename):
firdict = vars_indents(filename)[0]
firtup_keys = firdict.keys()
firtup_val = firdict.values()
for keys in firtup_keys:
for values in firtup_val:
index = 0
for index in range(len(values)):
firvallist = firtup_val[index]
for item in firvallist:
if len(item[0]) == 1:
singlechar.append({'ERROR_TYPE': 'SINGLE_CHAR_VAR', 'LINE_NUMBER': str(keys),'COLUMN': str(item[1]),'INFO': str(item[0]),'SOURCE_LINE': str(lines[keys - 1])})
else:
continue
return singlechar

这是我的代码,但没有产生任何输出,或者当我在 return 语句中移动时,产生了一个空列表。我希望它能给我一个字典列表作为输出。

有人可以教我如何解决这个问题吗?

谢谢

最佳答案

您应该首先调用该函数以获取输出。

SINGLE_CHAR_VAR(filename)

你怎么能期望一个函数在没有被调用的情况下运行呢?

关于 python : no output or only an empty list was produced,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26541954/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com