When ever I use the open with the 'r+' or the 'w+' parameters, It doesn't want to read the text file.
Inside Text Document:
hello
Python Code Examples:
code:
with open(file_name, 'r') as o:
print(o.read())
output:
hello
code:
with open(file_name, 'r+') as o:
print(o.read())
output:
code:
with open(file_name, 'w+') as o:
o.write('hello')
print(o.read())
output:
I also tried setting o.read() as a variable and then printing it, but there still was no output. If someone could please tell me why this happens, that would be great.