About 788,000 results
Open links in new tab
  1. Python Save to file - Stack Overflow

    file was deprecated and removed in python 3, so it's perfectly ok to use there. I didn't see the 2.7 tag on the question, and I usually use python 3...

  2. How do I save data in a text file python - Stack Overflow

    Mar 24, 2015 · First of all you should ask your question clearly enough for others to understand.To add a text into text file you could always use the open built-in function.Do it like this.

  3. How to save a Python interactive session? - Stack Overflow

    Jun 4, 2009 · I find myself frequently using Python's interpreter to work with databases, files, etc -- basically a lot of manual formatting of semi-structured data. I don't properly save and clean up the …

  4. 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.

  5. python - Saving an Object (Data persistence) - Stack Overflow

    Dec 25, 2010 · If you are looking to save an object (arbitrarily created), where you have attributes (either added in the object definition, or afterward)… your best bet is to use dill, which can serialize almost …

  6. How to save Python coding in Command Prompt as a file?

    May 28, 2015 · If this option is given, the raw input as typed as the command line is used instead. -f: force overwrite. If file exists, %save will prompt for overwrite unless -f is given. -a: append to the file …

  7. python - Saving and loading objects and using pickle - Stack Overflow

    It seems you want to save your class instances across sessions, and using pickle is a decent way to do this. However, there's a package called klepto that abstracts the saving of objects to a dictionary …

  8. python - How do I write JSON data to a file? - Stack Overflow

    How do I write JSON data stored in the dictionary data to a file? f = open ('data.json', 'wb') f.write (data) This gives the error: TypeError: must be string or buffer, not dict

  9. How to save python dictionary into json files? - Stack Overflow

    Mar 16, 2017 · This makes the json file more user friendly to read. the pydoc has some good description on how to use the json module. To retrieve your data back, you can use the load function.

  10. How can I use pickle to save a dict (or any other Python object)?

    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...