Python中的CSV文件的“另存为”向导

时间:2012-07-26 06:53:04

标签: python excel csv python-2.7

我可以使用以下代码保存Excel文件:

f = cStringIO.StringIO()  # This is a buffer to Store the above values
wb.save(f)  # This will save the buffer
output_data=base64.encodestring(f.getvalue()) 
res = self.write(cr, uid, ids, {'state':'get','data':output_data, 'name':'kpi.xls'}, context=context)
return res 

但我无法使用另存为向导保存CSV文件。

1 个答案:

答案 0 :(得分:0)

代码和解释不完整,但据我所知,你需要一个"另存为"对话。 tkFileDialog中的Tkinter应该可以解决问题。

 filename = tkFileDialog.asksaveasfilename()
res = self.write(cr, uid, ids, {'state':'get','data':output_data, 'name':filename}, context=context)