Advertisements
Advertisements
प्रश्न
Differentiate between write() and writelines().
फरक स्पष्ट करा
उत्तर
- write() method takes a string as an argument and writes it to the text file.
- writelines() method is used to write multiple strings to a file. We need to pass an iterable object like lists, tuple etc. containing strings to writelines() method.
shaalaa.com
Writing to a Text File
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
APPEARS IN
संबंधित प्रश्न
If we open an existing file in the ______ mode the previous data will be erased and the file object will be positioned at the beginning of the file.
Which method takes string as an argument and writes it to the text file?
The writelines() method can write multiple lines with the help of: