file handling in the python

technical talkiess
0

 print("File handling")


# only write the file and override the existing content of the file
# f = open("test.txt","w")
# f.write("test")
# this content adding in the new line of the file and not override the file
# f = open("test.txt","a")
# f.write("This is the new text\n")

f = open("test.txt","r+")
f.write("This is the new text\n")
content = f.read()
print(content)
Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)