Pyexcel, how to save a dict to csv file with pyexcel?

。_饼干妹妹 提交于 2020-03-05 06:06:35

问题


This part of the topic is solved, see my last answer to this topic. I'm having trouble to save a dictionary using the pyexcel module.

I instaled the pyxecel module with pip3 install pyexcel

So I have a dictionary and I'm doing this:

import pyexcel as pe
myDict = {...}
pe.save_as(dict = myDict, dest_file_name = "dest_file.xls")

In my terminal, when I compile the code, it prints myDict but just after I have this:

Otherwise unrecognized parameters were given.

terminal output

I look for a solution and it could be related to this: https://pyexcel-io.readthedocs.io/en/latest/pyinstaller.html But I don't understand how to use the --hiden-import in my code or terminal? When I use this in my code I have a syntax error.

Can someone help me, please? Thank you in advance.

edit: use pe.save_as(adict = myDict, dest_file_name = "dest_file.xls") to solve the problem.


回答1:


The reason that this is failing is because the method call save_as() doesn't accept a parameter named dict. According to the documentation, providing a dict should either be done via the adict or with_keys parameters:

pe.save_as(adict = myDict, dest_file_name = "dest_file.xls")


来源:https://stackoverflow.com/questions/60423084/pyexcel-how-to-save-a-dict-to-csv-file-with-pyexcel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!