Python Advanced Tutorial 11 - Pickle

preview_player
Показать описание
This is tutorial covering how to use pickle to serialize python object hierarchies. Saving lists, dictionaries and custom classes. All Links and Slides will be in the description. Subscribe for more cool stuff!

If you like what you see be sure to subscribe and thumbs up!
Рекомендации по теме
Комментарии
Автор

@trsk I just follow the conventions that I've become accustomed to over the years... mixedCase for variables & Functions, CamelCase for classes, ALL_CAPS for constants, etc.
I'll make the move sooner rather than later I suppose.

DrapsTV
Автор

Hello,
If i dump "ID 2" in script and now in my script two ID available,
but now i want to print only second ID output how is this possible ??

reply me

rupeshegishte
Автор

@Draps Can I load mine CSV/txt file and then another text file, and extracting the matching words.

jaypratappandey
Автор

Would Pickle be able to dump and load a List populated with Class objects? e.g:


class Item()
def __init__(self, name, material):
self.name = name
self.material = material

def explain(self):
print self.name
print self.material



myList = [Item("Table", "Wood"), Item("Window", "Glass"))


Could Pickle dump and load 'myList'?

killboy
Автор

I get maximum recursion error if I try to dump an instance of my class to a pkl file. Absolutely not a clue why, very annoying :( Works fine if I try my main class.

Edit: I think it is to do with my class having bs4.navigable_string objects or something apparently? But I deleted those and it still doesn't work. Guess I just won't use it :P

petrockspiracy
Автор

Can i use this to send a list of string to my iphone application? If i can is it better/faster than json?

TimocinZ
Автор

i have a python list of python visual object" 3d position vector". i tried to pickle that list but i am getting a run time error "Pickling of instances is not enabled". May i request your comment on this.

vikcy
Автор

Si yo tengo creado un archivo .py que contiene varios diccionarios y quisiera modificar desde la consola el valor de alguno de esos diccionarios con pickle ¿como lo haría? Gracias

aurarueda
Автор

si en este caso  no quisiera leer el diccionario sino solo la lista como lo haría..?? por que cuando utilizo pickle.load me carga  lo primero que encuentre en el archivo en este caso el dict1 

aurarueda
Автор

What is pickle you may ask?
Here is the answer:

AzizSobirov
welcome to shbcf.ru