Storing and retrieving Python objects with 'pickle'

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

This is literally the most useful pickle video i've seen while trying to learn it so far, thanks a ton

lordbuckethead
Автор

When you said, "The world should listen to my suggestions more"...
It reminded me of my dad.

Great video though.

inzemam
Автор

Me: _chillin_
Him: *types at 0:44
Me: 👁👄👁

Momo-bbfn
Автор

I really like you're teaching style and would like to say thanks for this content! Cheers.

aaronhumanistallen
Автор

Thank you so much. I was fearing I couldn't save my objects for the future, as they took me nearly an hour to get (65 million iterations of something, yay). I am saved

Jerryboy
Автор

Wow. Why aren't there more views on this channel! LOVE the way you teach _/\_

sakshiwahi
Автор

well its a pretty cool stuff, but as you said, pickle sometime do not work for some object. recently i was trying to pickle the object of my stock broker connection and it throwed error that object with the thread lock cannot be pickled

FusionCorporation-jxou
Автор

Thanks for that very interesting vid. I type pretty fast, but man, you're _really_ fast!
Question:
I pickle and unpickle a LOT, and rather than opening a file; save/load data, close file; or even using "with open" (both of which I can do and have done in the past), I always use:
my_dict = pickle.load(open('somefile', 'rb'))
pickle.dump(my_dict, open('otherfile', 'wb'), -1)
So, it's a one-liner. Easy as pie.
Do you object to that coding style? I've checked, and it doesn't leave any leftover open filehandles. So, I don't think I'm wasting system resource, and the one-line style seems clear to me.
[edit: fix typo]

josephgaviota
Автор

How do i resolve 'cant pickle weakref objects'?

sahilmane
Автор

I like you're teaching style as well! Without 6:36 I'd have been looking for my problem for ages...
What's the point of pickling a class definition if you have to import it for using it in another file after unpickling it?

martinocrespoalvarez
Автор

sir.. please help me resolve my errors.type error- thread.rlock object while pickling, save n load the cnn model

Utkarsh_Kumar
Автор

Perfect explanation, thank you! I just have one more doubt, how do I make if I wann to store more than one class object in the same file? Example: I have a class "Car", and objects car1 and car2, and my objective is to store car1 and car2 in the "mydata.pkl" file

thiagoamorim
Автор

Hi there, I appreciate your video. But, I was trying to dump my own class object and this class contains a Simpy environment and I always get "AttributeError: 'Environment' object has no attribute" when I try to load that file to a variable again.
I am using tkinter to generate a GUI to dump and load process, it allows me to generate this object too. Do you have any idea on how to figure this out?

Pedro-kwce
Автор

And if you got a pickle.py file in your pycharm, like i did, it doenst work because it tries to import it/itself instead of using the library :D. Thats why i had to rename my tutorial file from "pickle.py" to "pikle.py"

galan