问题
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