NSSC/Exercise_02/util.py

12 lines
266 B
Python
Raw Normal View History

2022-04-10 09:17:15 +00:00
from state import State
def readFile (path: str) -> State:
with open(path) as f:
lines = f.readlines()
return State.deserialize(lines)
def writeFile (path: str, state: State) -> None:
with open(path, 'w') as f:
f.write(state.serialize())