Q. Write a method in Python to write multiple line of text contents into a text file mylife.txt.


Answer =


f1 = open("pathwala.txt", 'r')
f2 = open("myfile.txt", "w")

data = f1.readlines()
for i in data :
    f2.write(i)
        
f2.close()


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post