About 1,750,000 results
Open links in new tab
  1. open() in Python does not create a file if it doesn't exist

    Jun 3, 2010 · The file pointer is at the end of the file if the file exists. The file opens in the append mode. If the file does not exist, it creates a new file for reading and writing. - Python file modes seek () …

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

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

  4. python - How to replace/overwrite file contents instead of appending ...

    When you say "replace the old content that's in the file with the new content", you need to read in and transform the current contents data = file.read(). You don't mean "blindly overwrite it without needing …

  5. python - How to open local file on Jupyter? - Stack Overflow

    It's a pity there is no possibility to right-click any folder in jupyter's "explorer view" and get a menu option to open the folder in the true os file explorer. This leads to convoluted tricks for files and folders …

  6. python - Why am I getting a FileNotFoundError? - Stack Overflow

    $ python script.py In order to make this work, the directory containing the python executable must be in the PATH, a so-called environment variable that contains directories that are automatically used for …

  7. How can I make one python file run another? - Stack Overflow

    How can I make one python file to run another? For example I have two .py files. I want one file to be run, and then have it run the other .py file.

  8. Creating a BAT file for python script - Stack Overflow

    Jan 1, 2011 · How can I create a simple BAT file that will run my python script located at C:\\somescript.py?

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

  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 …