Linked Questions
12 questions linked to/from Saving and loading objects and using pickle
733
votes
10
answers
1.2m
views
How can I use pickle to save a dict (or any other Python object)? [duplicate]
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 ...
382
votes
6
answers
467k
views
Saving an Object (Data persistence) [duplicate]
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?
10
votes
3
answers
29k
views
How to mock data as request.Response type in python
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 ...
1
vote
1
answer
4k
views
Python: saving and loading a class definition
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 ...
1
vote
3
answers
13k
views
How to unpack a pkl file? [duplicate]
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....
4
votes
2
answers
5k
views
Python: Saving dictionary to .py file
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 ...
0
votes
2
answers
3k
views
Python: Errors saving and loading objects with pickle module
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:...
0
votes
1
answer
2k
views
How do I retrieve a model stored in BLOB storage from in an azure function written in Python (UnpicklingError)
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 ...
0
votes
1
answer
1k
views
Serialized object byte string to regular string
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 ...
0
votes
5
answers
232
views
Writing and reading a list from a file in Python
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,...
0
votes
1
answer
97
views
How do I create a variable in Python that doesn't get deleted when I close the program?
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 ...
0
votes
1
answer
50
views
Modify a list saved in a .txt file
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 ...