Class - 12 CBSE Computer Science Important File Handling Questions 2025
Write a command(s) to write the following lines to the text file named hello.txt. Assume that the file is opened in append mode.
“ Welcome my class”
“It is a fun place”
“You will learn and play”
Python File Handling
1 Like
Answer
file = open("hello.txt", "a")
lines = [
"Welcome my class\n",
"It is a fun place\n",
"You will learn and play"
]
file.writelines(lines)
file.close()
Answered By
1 Like