About 50 results
Open links in new tab
  1. Write data to a file in Python - Stack Overflow

    Aug 24, 2015 · Python has three main built-in ways to persist data: pickle which serialises objects to files; sqlite - an embedded SQL database, which is supported by many ORM systems (which with …

  2. python - How to write a list of numbers as bytes to a binary file ...

    With Python 2 on Windows, I found that writing a bytearray still converts \n to \r\n, making it unsatisfactory for binary data, if the "b" flag is not passed when opening the file.

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

    3344 data is a Python dictionary. It needs to be encoded as JSON before writing. Use this for maximum compatibility (Python 2 and 3):

  4. How to write to an Excel spreadsheet using Python?

    Python programs can easily read and write text, so a csv file is the easiest and fastest way to export data from your python program into excel (or another python program).

  5. python - How do I append to a file? - Stack Overflow

    Jan 16, 2011 · On some operating systems, opening the file with 'a' guarantees that all your following writes will be appended atomically to the end of the file (even as the file grows by other writes). A few …

  6. Write a raw binary file with NumPy array data - Stack Overflow

    May 10, 2012 · I'd like to save the contents of a numpy float array into a raw binary file as signed 16 bit integers. I tried to accomplish this using ndarray.tofile but I can't figure out the right format string...

  7. python - Correct way to write line to file? - Stack Overflow

    May 28, 2011 · the_file.write("Hello") in append mode after each write the cursor move to new line, if you want to use w mode you should add \n characters at the end of the write() function:

  8. python - Writing a pandas DataFrame to CSV file - Stack Overflow

    May 21, 2019 · 1. errors= is sometimes useful If a file has to have a certain encoding but the existing dataframe has characters that cannot be represented, errors= can be used to "coerce" the data to be …

  9. Writing binary data to a file in Python - Stack Overflow

    May 21, 2015 · I am trying to write data (text, floating point data) to a file in binary, which is to be read by another program later. The problem is that this program (in Fort95) is incredibly particular; each ...

  10. How can I write data in YAML format in a file? - Stack Overflow

    Sep 18, 2012 · I need to write the below data to yaml file using Python: