English

How is write() different from writelines()?

Advertisements
Advertisements

Question

How is write() different from writelines()?

Very Short Answer
Advertisements

Solution

write() writes one string to a file. writelines() writes a sequence of strings, such as a list or tuple. Neither method automatically adds a newline character; \n must be included explicitly.

shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Data File Handling - EXERCISE [Page 145]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 7 Data File Handling
EXERCISE | Q 5. | Page 145
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×