如何使用tksheet以csv格式文件保存表格?

2024-06-28 11:24:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用python获取表上的值,并将其保存到csv文件中并加载它。 我使用模块tksheet,我不知道如何保存和加载它

self.col_data = self.sheet_demo.get_column_data(2)
print(type(self.col_data))

#self.coldata = open('Monfichier.csv' , ' w')
with open('monFichierduxcole.csv', mode = 'w') as self.datacol:
        datacol.write(str(self.col_data))
self.datacol.reader('monFichierduxcole.csv', dialect='excel')
self.datacol.close()

变量self.data_data是一个列表

要获取的表:

screenshot of table to get

我当前收到以下错误:

with open('monFichierduxcole.csv', mode = 'w') as self.datacol: 

TypeError: open() missing required argument 'flags' (pos 2) 

Tags: 模块文件csvselfdatademomodeas