MCPcopy Create free account
hub / github.com/Tokeii0/VolatilityPro / load_csv_to_table

Method load_csv_to_table

QtGUI_run.py:148–169  ·  view source on GitHub ↗
(self,filename)

Source from the content-addressed store, hash-verified

146 self.ui.dumpfilename.clear()
147 # 一般的加载csv文件到table
148 def load_csv_to_table(self,filename):
149 txt_file = rf"output/{filename}.txt"
150 csv_file = rf"output/{filename}.csv"
151 with open(txt_file, "r") as f:
152 lines = f.readlines()
153 data = [line.strip().split() for line in lines]
154 with open(csv_file, "w", newline="") as f:
155 writer = csv.writer(f)
156 writer.writerows(data)
157 filename = f"output/{filename}.csv"
158 if not os.path.exists(filename):
159 return
160 with open(filename, "r") as f:
161 lines = f.readlines()
162 lines = [line for line in lines if line.strip()]
163 lines = [line.strip().split(',') for line in lines]
164 self.ui.tableWidget.setRowCount(len(lines))
165 self.ui.tableWidget.setColumnCount(len(lines[0]))
166 for i, row in enumerate(lines):
167 for j, col in enumerate(row):
168 self.ui.tableWidget.setItem(i, j, QTableWidgetItem(col))
169 self.ui.tableWidget.resizeColumnsToContents()
170 # 加载clipboard到table
171 def load_clipboard_to_table(self):
172 filename = "clipboard"

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected