2 Answers
+ 1
Hi @Omar Falk, you are very right. Thanks, I did not observe this.
+ 8
Hi,
you use file for two different purposes.
1. here-->
file = open("basic.py", "r+")
2.--> here
file = file.read()
print(file)
file.close()
With 2. you overwrite first use and your variable file is not a file handler but a string.
Solution: Use different variables.
for 2nd for example the variable content