About 9,260,000 results
Open links in new tab
  1. python - Difference between modes a, a+, w, w+, and r+ in built …

    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 …

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

  3. Unicode (UTF-8) reading and writing to files in Python

    I'm having some brain failure in understanding reading and writing text to a file (Python 2.4).

  4. python - How can I open a URL? - Stack Overflow

    How can I open a URL? Asked 14 years, 11 months ago Modified 1 year, 5 months ago Viewed 622k times

  5. Reading a file using a relative path in a Python project

    Say I have a Python project that is structured as follows: project /data test.csv /package __init__.py module.py main.py __init__.py: from .module import test ...

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

    401 Python allows putting multiple open() statements in a single with. You comma-separate them. Your code would then be: def filter(txt, oldfile, newfile): '''\ Read a list of names from a file line …

  7. python - Errno 13 Permission denied - Stack Overflow

    Jul 16, 2020 · As you are a windows user you just need to right click on python ide => select option 'Run as Administrator' and then run your command. And if you are using the command …

  8. python - What encoding does open () use by default? - Stack …

    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 …

  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 …

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

    On Python 3.4, the pathlib module was added, and the following code will reliably open a file in the same directory as the current script: from pathlib import Path