简体   繁体   English

我可以像将.mat文件拖放到Matlab中一样,将pickle文件拖放到PyCharm中吗?

[英]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库。

Example

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

Reference: 参考:

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.

相关问题 如何在 PyCharm 中运行我的 MATLAB 文件? - How can I run my MATLAB files in PyCharm? 为什么我只能腌制 2 个文件而只能取消腌制一个? - Why can I only pickle 2 files BUT only unpickle one? 如何同时拖放多个小部件我可以拖动标签但想同时拖动它们 - How can i drag and drop multiple widgets at the same time i can drag my labels but want to drag them at the same time 如何从pycharm中的txt文件中读取特定单词 - How I can read specific words from txt files in pycharm 如何获得PyCharm识别静态文件? - How can I get PyCharm to recognize the static files? 如何在R或MATLAB中打开3D .npy文件? - How can I open a 3D .npy file in R or MATLAB? “只能从 Matlab 5 级 MAT 文件中读取” - “Can only read from Matlab level 5 MAT-files” 如何获取 token-sheets.pickle 和 token-drive.pickle 文件以将 ezsheets 用于 Google 表格? - How can I get the token-sheets.pickle and token-drive.pickle files to use ezsheets for Google Sheets? 我可以直接加载想要的对象,在意甲中跳过其他对象以获得泡菜文件吗? - Can I load directly an object that I want, jumping others in the serie, for pickle files PyGTK:无法将文本文件拖放到我的应用程序中 - PyGTK: Can't drag and drop text files into my application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM