问题描述
该主题的这一部分已解决,请参阅我对此主题的最后一个答案.我无法使用pyexcel模块保存字典.
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.
我用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")
在我的终端中,当我编译代码时,它会打印myDict,但仅在我拥有此代码后:
In my terminal, when I compile the code, it prints myDict but just after I have this:
Otherwise unrecognized parameters were given.
我正在寻找解决方案,它可能与此有关: https: //pyexcel-io.readthedocs.io/zh-CN/latest/pyinstaller.html 但是我不明白如何在我的代码或终端中使用--hiden-import?当我在代码中使用此代码时,出现语法错误.
I look for a solution and it could be related to this: https://pyexcel-io.readthedocs.io/en/latest/pyinstaller.htmlBut 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.
使用pe.save_as(adict = myDict, dest_file_name = "dest_file.xls")
解决问题.
推荐答案
之所以失败,是因为方法调用save_as()
不接受名为dict
的参数.根据文档,提供dict应该通过adict
或with_keys
参数来完成:
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")
这篇关于pyexcel,如何使用pyexcel将字典保存到csv文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!