現在、SNMP データを分析するための Python スクリプトに取り組んでいます。csv ファイルを読み取り、CheckListBox に編成された CheckBoxes にヘッダーを表示する機能があります。最初の項目を削除したいのですが、そうすると CheckListBox が読み込まれず、その理由がわかりません。コードは次のとおりです。
#Generates CheckBoxList with fields from csv (first row)
def onSNMPGen(self,e):
#reads in first row of csv file; this snmpPaths[0] will likely cause issues with multiple paths -- fix later
listItems = []
print "*** Reading in ", self.snmpPaths[0], "....."
with open(self.snmpPaths[0], 'r') as f: #remember to close csv
reader = csv.reader(f)
print "*** Populating Fields ..... "
for row in reader:
#Inserts each field into CheckListBox as an item;
#self.SNMPCheckListBox.InsertItems(row,0)
listItems.append(row)
break
f.close()
#Need to remove 'Time' (first item) from listItems
#listItems.pop(0) # this makes it so my CheckListBox does not populate
#del listItems[0] # this makes it so my CheckListBox does not populate
for key in listItems:
self.SNMPCheckListBox.InsertItems(key,0)