About 212,000 results
Open links in new tab
  1. How do I save and restore multiple variables in python?

    The question was "How do I save and restore multiple variables in python?" Please update your answer how to handle multiple variables in a pickle, instead of one variable.

  2. How to save all the variables in the current python session?

    I want to save the output (variables) of some of these commands, so that in future whenever I need access to the output, I can just fire up a python shell and load all these variables.

  3. saving and reloading variables in Python, preserving names

    Feb 19, 2021 · As Epsi95 said, you can use the pickle module in Python, which saves Python objects into files. If you want to record the values of global variables, then use these functions …

  4. Save variable value in python - Stack Overflow

    May 2, 2013 · 2 Is there a way to SAVE the value of a variable (say an integer) in python? My problem involves calling (entering and exiting) multiple times the same python script (python …

  5. saving variables within function - python - Stack Overflow

    Aug 7, 2013 · 2 Assuming all of the variables you want to save are local to the current function, you can get at them via the locals function. This is almost always a very bad idea, but it is …

  6. python - How can I store a result of a function in a variable instead ...

    The word 'properly' is just thrown in there. I'm trying to run the randombb function with it's purpose to get the result from the function random.random and store it in variable a.

  7. How do I save results of a "for" loop into a single variable?

    Mar 24, 2015 · Since 'saving to a variable', you can ditch the print (because it is used for a side-effect and not value generation) in which case a List Comprehension would be an idiomatic …

  8. Keep persistent variables in memory between runs of Python script

    Jul 14, 2011 · Not without reload, no. The environment would be cleared when your python process died. But using the above mechanism you could store in os.environ but now you are …

  9. python - Write variable to file, including name - Stack Overflow

    0 To save a variable (such as a NumPy array) as a .txt file in Python, you can use the numpy.savetxt function. Here's an example: import numpy as np # Example variable (NumPy …

  10. python - Saving a variable in a text file - Stack Overflow

    May 9, 2015 · I would like to save variable (including its values) into a text file, so that the next time my program is opened, any changes will be automatically saved into the text file .For …