So I made a script like this:
a = open("movies.txt","r")
And I wanted to write something in this so I did:
a.write("EndGame")
But it said it could not write, why?
So I made a script like this:
a = open("movies.txt","r")
And I wanted to write something in this so I did:
a.write("EndGame")
But it said it could not write, why?
that is because you have entered a wrong file mode. You used r
which stands for reading while you should use the w
for the writing. That code should work.
a = open("movies.txt","rw")
a.write("EndGame")
a.close()