About 55,600 results
Open links in new tab
  1. function - How to Open a file through python - Stack Overflow

    Oct 22, 2013 · I am very new to programming and the python language. I know how to open a file in python, but the question is how can I open the file as a parameter of a function? example: function …

  2. python - How to open a file for both reading and writing ... - Stack ...

    Jul 11, 2011 · Is there a way to open a file for both reading and writing? As a workaround, I open the file for writing, close it, then open it again for reading. But is there a way to open a file for both readi...

  3. python - Difference between modes a, a+, w, w+, and r+ in built-in …

    In Python's built-in open function, what is the difference between the modes w, a, w+, a+, and r+? The documentation implies that these all allow writing to the file, and says that they open the files for …

  4. open() in Python does not create a file if it doesn't exist

    Jun 3, 2010 · What is the best way to open a file as read/write if it exists, or if it does not, then create it and open it as read/write? From what I read, file = open ('myfile.dat', 'rw') should do this, right?...

  5. python - How to read pickle file? - Stack Overflow

    The following is an example of how you might write and read a pickle file. Note that if you keep appending pickle data to the file, you will need to continue reading from the file until you find what …

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

  7. python - How to reliably open a file in the same directory as the ...

    Closed 2 years ago. I used to open files that were in the same directory as the currently running Python script by simply using a command like:

  8. python - How to open a file using the open with statement - Stack …

    I'm looking at how to do file input and output in Python. I've written the following code to read a list of names (one per line) from a file into another file while checking a name against the name...

  9. Open file in a relative location in Python - Stack Overflow

    Aug 24, 2011 · Suppose my python code is executed a directory called main and the application needs to access main/2091/data.txt. how should I use open (location)? what should the parameter location …

  10. python - What encoding does open () use by default? - Stack Overflow

    The default UTF-8 encoding of Python 3 only extends to conversions between bytes and str types. open() instead chooses an appropriate default encoding based on the environment: encoding is the …