简体   繁体   English

如何访问 Python 文件(.pkl、pickle)中的数据?

[英]How do I access data from Python files (.pkl, pickle)?

New here and figured this would be the perfect place to ask a quick question.新来的,并认为这将是提出快速问题的理想场所。

I've been struggling to access the data from this webpage: http://sidekick.epfl.ch/data我一直在努力从这个网页访问数据: http://sidekick.epfl.ch/data

I need to access the data for my thesis, but the "example.py" file that is supposed to run and explain how to use the data simply doesn't.我需要访问我的论文的数据,但是应该运行并解释如何使用数据的“example.py”文件根本没有。 I've also never encountered ".pkl" files in the past which is making things harder.我过去也从未遇到过“.pkl”文件,这让事情变得更加困难。

I haven't had any problem with the npy files, but I'd love to get some help so I can run all the files and get a full picture of the data.我对 npy 文件没有任何问题,但我很想获得一些帮助,以便我可以运行所有文件并全面了解数据。 If anyone knows how, could you please explain the procedure to me?如果有人知道怎么做,你能向我解释一下程序吗? I only have a basic understanding of the concepts.我对这些概念只有基本的了解。

Thank you all very much for your help,非常感谢大家的帮助,

Marc马克

You can load pickle files as follows.您可以按如下方式加载泡菜文件。 Don't forget to add "rb" to the open method, as you need to open the file in binary mode.不要忘记在open方法中添加"rb" ,因为您需要以二进制模式打开文件。

import pickle

with open(path, "rb") as f:
    content = pickle.load(f)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 opencv 打开 pkl 文件? - How do I open pkl files with opencv? 加载Python Pickle(.pkl)文件 - load Python Pickle (.pkl) file 如何快速从pkl文件附加或连接许多熊猫数据帧? - How do I quickly append or concatenate many pandas dataframes from pkl files? 如何从S3存储桶加载pickle(.pkl)文件 - How to load pickle(.pkl) file from S3 bucket 如何不覆盖我的保存数据? (python中的泡菜) - How do I not overwrite my save data? (pickle in python) 如何腌制“记忆” Python function? - How do I pickle a “memoized” Python function? 如何从Data Science Experience上的Python访问Bluemix Object Storage上的文件? - How do I access files on Bluemix Object Storage from Python on Data Science Experience? Python-为我提供了包含XGBoost模型的泡菜文件。 我如何找到文件的详细信息? - Python - I was given pickle files that contain XGBoost models. How do I find the details of the file? 如何从2个pkl文件创建Python嵌套字典/将2个嵌套字典合并为一个? - How to create a Python nested dictionary from 2 pkl files/combine 2 nested dictionaries into one? 如何在我的 python 脚本中使用的 pkl 文件中编写 write() 方法? - How do I write a write() method in a pkl file that I can use in my python scrpits?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM