Advertisements
Advertisements
प्रश्न
Explain the use of output function writelines() with an example.
कोड लेखन
स्पष्ट करा
Advertisements
उत्तर
writelines(): Writes a sequence of strings. Newline characters must be supplied by the programmer.
lines = ["First line\n", "Second line\n"]
with open("data.txt", "w") as file:
file.writelines(lines)shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
