Saving Games in Python
UmarQureshi4

Hiya!

So, I need help with a function in my game, Stormfront.

Basically, I need a simple way of saving my game using a specific keyword. Is there any answer to my question?

< Umar Qureshi >

You are viewing a single comment. View All
Answered by InvisibleOne [earned 5 cycles]
View Answer
[deleted]

You could also use a txt file and use json to retrieve the files.
Ex:
f = open("hello.txt", "w") # "w" will always overwrite the file
f.write("Hello Text File!")
f.close()
And then:
f = open("grocery.txt", "r")
text = f.read() # this gives us everything back at once
f.close()
print(text)
Then use json to get the data back.
To append use "a" in open("hello.txt", a)