Skip to main content
added 254 characters in body
Source Link
Alok Agarwal
  • 3.1k
  • 3
  • 26
  • 34

All file modes in Python

  • r for reading
  • w for writing
  • r+ opens for reading and writing (cannot truncate a file)
  • w for writing
  • w+ for writing and reading (can truncate a file)
  • rb for reading a binary file. The file pointer is placed at the beginning of the file.
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending
  • ab+ Opens a file for both appending and reading in binary. The file pointer is at the end of the file if the file exists. The file opens in the append mode.
  • x open for exclusive creation, failing if the file already exists (Python 3)

All file modes in Python

  • r for reading
  • w for writing
  • r+ opens for reading and writing (cannot truncate a file)
  • w+ for writing and reading (can truncate a file)
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending
  • x open for exclusive creation, failing if the file already exists (Python 3)

All file modes in Python

  • r for reading
  • r+ opens for reading and writing (cannot truncate a file)
  • w for writing
  • w+ for writing and reading (can truncate a file)
  • rb for reading a binary file. The file pointer is placed at the beginning of the file.
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending
  • ab+ Opens a file for both appending and reading in binary. The file pointer is at the end of the file if the file exists. The file opens in the append mode.
  • x open for exclusive creation, failing if the file already exists (Python 3)
Added Supported mode for python 3
Source Link
Alok Agarwal
  • 3.1k
  • 3
  • 26
  • 34

All file modes in Python

  • r for reading
  • w for writing
  • r+ opens for reading and writing (cannot truncate a file)
  • w+ for writing and reading (can truncate a file)
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending
  • x open for exclusive creation, failing if the file already exists (Python 3)

All file modes in Python

  • r for reading
  • w for writing
  • r+ opens for reading and writing (cannot truncate a file)
  • w+ for writing and reading (can truncate a file)
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending

All file modes in Python

  • r for reading
  • w for writing
  • r+ opens for reading and writing (cannot truncate a file)
  • w+ for writing and reading (can truncate a file)
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending
  • x open for exclusive creation, failing if the file already exists (Python 3)
Improve presentation
Source Link
Jonathan Leffler
  • 759.4k
  • 145
  • 961
  • 1.3k

All file modemodes in pythonPython

r for reading w for writing r+ opens for reading and writing(cannot truncate a file) w+ for writing and reading(can truncate a file) rb+ reading or writing a binary file wb+ writing a binary file a+ opens for appending 
  • r for reading
  • w for writing
  • r+ opens for reading and writing (cannot truncate a file)
  • w+ for writing and reading (can truncate a file)
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending

All file mode in python

r for reading w for writing r+ opens for reading and writing(cannot truncate a file) w+ for writing and reading(can truncate a file) rb+ reading or writing a binary file wb+ writing a binary file a+ opens for appending 

All file modes in Python

  • r for reading
  • w for writing
  • r+ opens for reading and writing (cannot truncate a file)
  • w+ for writing and reading (can truncate a file)
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending
Source Link
Alok Agarwal
  • 3.1k
  • 3
  • 26
  • 34
Loading