# "+" plus means read and write together
#1st Way
f = open("input.txt", "r+")
print("1st :: ")
print("Readable :: ", f.readable())
print("Writeable :: ", f.writable())
f.close()
#Another Way
f = open("input.txt", "w+")
print("\n2nd :: ")
print("Readable :: ", f.readable())
print("Writeable :: ", f.writable())
f.close()
# Normally read means read text mode("rt) and write means write text mode("wt")
f = open("input.txt", "rt")
print("\n3rd :: ")
print("Readable :: ", f.readable())
f.close()
f = open("input.txt", "wt")
print("Writeable :: ", f.writable())
f.close()
# "rb" means read binary mode and "wb" means read binary mode
# we can modify png file by "rb" and "wb"
# "+" means read and write both
# "rb+" or "rw+" we can read and write all file by that
f = open("input.txt", "rb+")
print("\n4rth :: ")
print("Readable :: ", f.readable())
print("Writeable :: ", f.writable())
f.close()
Comments
Post a Comment