About 55 results
Open links in new tab
  1. python - How to open a file using the open with statement - Stack …

    Using multiple open() items with with was not supported in Python 2.5 when the with statement was introduced, or in Python 2.6, but it is supported in Python 2.7 and Python 3.1 or newer.

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

    Oct 3, 2025 · 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 …

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

    Jul 11, 2011 · And: f.write (string) writes the contents of string to the file, returning None. Also if you open Python tutorial about reading and writing files you will find that: 'r+' opens the file for both …

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

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

  6. How to open and edit an existing file in Python? - Stack Overflow

    Dec 16, 2014 · The open() built-in Python method (doc) uses normally two arguments: the file path and the mode. You have three principal modes (the most used): r, w and a.

  7. How can I open multiple files using "with open" in Python?

    Since Python 3.3, you can use the class ExitStack from the contextlib module to safely open an arbitrary number of files. It can manage a dynamic number of context-aware objects, which means that it will …

  8. Método open() en Python - Stack Overflow en español

    Aug 19, 2020 · tengo un pequeño problema con open(). Como saben, podemos colocar argumentos que indican si abrimos un archivo externo en modo escritura, lectura u otro: from io import open …

  9. How can I open an Excel file in Python? - Stack Overflow

    Jul 13, 2010 · How do I open a file that is an Excel file for reading in Python? I've opened text files, for example, sometextfile.txt with the reading command. How do I do that for an Excel file?

  10. python - How to open every file in a folder - Stack Overflow

    217 I have a python script parse.py, which in the script open a file, say file1, and then do something maybe print out the total number of characters.