def open_sheet(self):
#self.check_change = False
path = ('./contacts.csv', 'CSV(*.csv)')
print(path)
if path[0] != '':
with open(path[0], newline='') as csv_file:
self.table_contacts.setRowCount(0)
self.table_contacts.setColumnCount(5)
my_file = csv.reader(csv_file, delimiter=',', quotechar='|')
for row_data in my_file:
row = self.table_contacts.rowCount()
self.table_contacts.insertRow(row)
if len(row_data) > 10:
self.table_contacts.setColumnCount(len(row_data))
for column, stuff in enumerate(row_data):
item = QTableWidgetItem(stuff)
self.table_contacts.setItem(row, column, item)
#self.check_change = True
print(self.table_contacts.rowCount())
评论列表
文章目录