Advertisements
Advertisements
प्रश्न
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”
टीपा लिहा
Advertisements
उत्तर
Assumed this statement, as stated in question -
filehandle = open("hello.txt","a")
commands to write following lines are -
1 file_handle = open("hello.txt", "a")
2 file_handle.write("Welcome my class")
3 file_handle.write("It is a fun place")
4 file_handle.write("you will learn and play")
5 file_handle.close()shaalaa.com
Opening and Closing a Text Files in Python
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
