你能帮我弄清楚这个简单的编码问题吗? 我试图得到索引线的'VIS'值。索引值预先作为'index'数组引入。
提前谢谢。
VIS = []
index = [20,25] # line indexes to read
def read_Visibility():
for i,file in enumerate(glob.glob(Path + '/*.txt')):
with open(file,encoding = 'latin-1') as f:
# go to index of (i + 52) and get the line
Vis_line = f.readlines()[index[i]+52]
# get the value of visibility if it is digit
value = [int(value) for value in str.split(Vis_line) if value.isdigit()]
return VIS.append(value)
VIS = read_Visibility()
print(VIS)
结果是:
无