簡體   English   中英

Python中CSV文件的“另存為”向導

[英]“Save As” wizard for CSV file in Python

我可以使用以下代碼保存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文件。

代碼和解釋不完整,但是據我了解,您需要一個“另存為”對話框。 Tkinter中的 tkFileDialog應該可以解決問題。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM