repl.it
@simon100/

Save System

Python

No description

fork
loading
Files
  • main.py
  • save.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if 'hearts' not in globals():
    try:
        file = open("save.py", "r")
        text3 = file.readline().split(" ")
        text31 = text3[0].split(":")
        text32 = text3[1].split(":")
        hearts = text31[1]
        food = text32[1]
        file.close()
        print("Hearts = " + hearts)
        print("Food = " + food)
    except FileNotFoundError:
        hearts = input("Hearts >")
        food = input("Food >")
        file = open("save.py", "w")
        print()
        file.write("Hearts:" + hearts + " Food:" + food)
        file.close()
        print()