हिंदी

Differentiate between r+ and w+ file modes in Python. - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Differentiate between r+ and w+ file modes in Python.

अंतर स्पष्ट करें

उत्तर

r+ mode:

  • Primary function is reading.
  • File pointer is at beginning of file.
  • if the file does not exist, it results in an error.

w+ mode:

  • primary function is writing.
  • If the file does not exist, it creates a new file.
  • If the file exists, previous data is overwritten.
  • File pointer is at the beginning of file.
shaalaa.com
Text File Open Modes
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×