[英]Can I drag and drop pickle files into PyCharm the same way I can d-n-d .mat files into Matlab?
In Matlab, I can drag-and-drop a .mat key-value-pair data file into the Matlab window and it will populate the Workspace of variables. 在Matlab中,我可以将.mat键值对数据文件拖放到Matlab窗口中,它将填充变量的工作区。
Is there a way to do the same thing in Python world, namely drag-and-drop .pkl files into PyCharm? 有没有一种方法可以在Python世界中做同样的事情,即将.pkl文件拖放到PyCharm中?
I can see from this question that I can use shelve rather than pickle for this goal. 从这个问题中我可以看出,我可以用货架而不是酱菜来达到这个目标。 Then any ideas on how to make this more drag-and-drop-y in context of PyCharm IDE? 那么关于如何在PyCharm IDE的上下文中进行更多拖放的任何想法?
PyCharm doesn't do that. PyCharm不会那样做。 Meantime, you can read a .pkl
file by using code in a pretty simple way. 同时,您可以通过非常简单的方式使用代码来读取.pkl
文件。 The following approach uses pickle
library. 以下方法使用pickle
库。
import pickle
# read python dict back from the file
pkl_file = open('myfile.pkl', 'rb')
mydict2 = pickle.load(pkl_file)
pkl_file.close()
print mydict2
https://www.saltycrane.com/blog/2008/01/saving-python-dict-to-file-using-pickle/ https://www.saltycrane.com/blog/2008/01/saving-python-dict-to-file-using-pickle/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.