有没有一种方法可以查看cPickle或Pickle文件内容,而无需在Windows中加载Python? [英] Is there a way to view cPickle or Pickle file contents without loading Python in Windows?
问题描述
我使用cPickle来保存程序每次运行时的数据集.由于有时我需要在不运行代码的情况下查看数据的轮廓,因此我希望有一种简单的方法,只需双击文件即可快速查看内容.我试图避免每次运行一个print
脚本时都必须加载终端并将python指向一个文件.
I use cPickle to save data sets from each run of a program. Since I sometimes need to see the outline of the data without running the code, I would like an easy way to quickly view the contents by just double-clicking on the file. I am trying to avoid having to load a terminal and pointing python to a file each time, just to run some print
script.
我在寻找Notepad ++插件,但找不到任何东西.
I looked for Notepad++ plugins but couldn't find anything.
有一些简单的方法可以做到这一点吗?有人有什么建议吗?
Is there some easy way to do this? Does anyone have any suggestions?
注意:我运行Windows 7.
Note: I run Windows 7.
推荐答案
对于Python 3.2 +/2.7 +,您可以从命令行查看(__repr__
个)泡菜:
For Python 3.2+/2.7+ you can view (__repr__
's of) pickles from the command-line:
$ python -c "import pickle; pickle.dump({'hello': 'world'}, open('obj.dat', 'wb'))"
$ python -mpickle obj.dat
{'hello': 'world'}
将其轻松集成到Windows shell中应该很容易.
It should be easy to integrate this into the Windows shell.
这篇关于有没有一种方法可以查看cPickle或Pickle文件内容,而无需在Windows中加载Python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!