import pickle a = 3; b = [11,223,435]; pickle.dump([a,b], open("trial.p", "wb")) c,d = pickle.load(open("trial.p","rb")) print(c,d) ## To verify
Here is what the above code is Doing:
1. We create a variable a and assign it the value 3.
2. We create a variable b and assign it the value [11,223,435].
3. We use pickle.dump() to save the value of a and b to a file named trial.p.
4. We use pickle.load() to load the values of a and b from the file trial.p.
5. We print the values of c and d to verify that they are the same as a and b.