Linked Questions

733 votes
10 answers
1.2m views

I have looked through the information that the Python documentation for pickle gives, but I'm still a little confused. What would be some sample code that would write a new file and then use pickle to ...
Chachmu's user avatar
  • 8,258
382 votes
6 answers
467k views

I've created an object like this: company1.name = 'banana' company1.value = 40 I would like to save this object. How can I do that?
Peterstone's user avatar
  • 7,489
10 votes
3 answers
29k views

I would like to write some testcase to exercise object_check in isinstance(obj, requests.Response) logic. After I create Mock data as return value for requests.post. The type for mock data is always ...
jacobcan118's user avatar
  • 9,309
1 vote
1 answer
4k views

I am interested in saving and load objects using the pickle module as you can read in a question I asked before: Python: Errors saving and loading objects with pickle module Someone commment: 1, In ...
Peterstone's user avatar
  • 7,489
1 vote
3 answers
13k views

I need to unpack a pkl file, but since I'm not familiar with pickle and pandas, I'm having a very hard time trying to do that. The content of the pkl file is something like: { 'woodi': array([-0....
Jonnathan Carvalho's user avatar
4 votes
2 answers
5k views

I have got a dictionary this_dict produced in a python script that I would like to write to a separate python module dict_file.py. This would allow me to load the dictionary in another script by ...
Quantum's user avatar
  • 203
0 votes
2 answers
3k views

I am trying to load and save objects with this piece of code I get it from a question I asked a week ago: Python: saving and loading objects and using pickle. The piece of code is this: class Fruits:...
Peterstone's user avatar
  • 7,489
0 votes
1 answer
2k views

I have an Azure function written in Python which has a simple purpose: return a prediction for a new observation based on a model I have trained, tested, and stored as a BLOB. I created the model ...
Matt Webster's user avatar
0 votes
1 answer
1k views

I need to convert the byte string of a serialized object ( I used pickle ) to a normal string. The reason I need to do this is because I need to get the number of the package and I cannot convert b'0 ...
Michael's user avatar
0 votes
5 answers
232 views

I want to save a list in python to a file which should be able to read later and added to a list variable in later use. As an example list = [42,54,24,65] This should be written to a file as [42,...
rksh's user avatar
  • 4,050
0 votes
1 answer
97 views

I want to create a program, but I need a variable that doesn't reset every time I close the program. I don't know how to do it, and all the other answers I found here don't make sense to me. If anyone ...
Person12343's user avatar
0 votes
1 answer
50 views

I have a list of this form in a .txt file: student1, 2, 3 | student2, 1, 4 I need to call it in a program, add [student3, 3, 5] to the list, and then save it back into the .txt file. I did this but my ...
MelvinCERBA's user avatar