I'm running a python code, The code is:
f = open("File.txt", "r")
f.write("my first file\n")
f.write("my second file \n\n")
f.write("contains three lines\n")
f.read(2)
but I'm keeping have an error:
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS F:\ping> python -u "f:\ping\file.py"
Traceback (most recent call last): File "f:\ping\file.py", line 2, in <module>
f.write("my first file\n")
io.UnsupportedOperation: not writable
What is wrong with my code?