Skip to content
Advertisement

Pickle all variables

I”m looking for a way to pickle all the variables with their values in a sorted order. I’m trying the method below:

Expected result: Append value of va to totalList , then vb's value..and so on. And then dump the totalList to a pickle file.

JavaScript

I’m getting result like this:

JavaScript

I want to get rid of the results ('pickle', 'time', 'os', 're') and [] and sort the result before appending to totalList or sort it before iteration.

Advertisement

Answer

Here’s a way to do what you want. You should ignore some variables you’re not interested in – specifically, imports and totalList.

JavaScript

The result is:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement