Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created December 24, 2019 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/d7e5352649f4de6eba55f85621204c8e to your computer and use it in GitHub Desktop.
Save chelseatroy/d7e5352649f4de6eba55f85621204c8e to your computer and use it in GitHub Desktop.
Reading the File
class KeyValueStore:
...
def catch_up(self, path_to_logs=''):
if path_to_logs == '':
path_to_logs = "logs/" + self.server_name + "_log.txt"
if os.path.exists(path_to_logs):
f = open(path_to_logs, "r")
log = f.read()
f.close()
for command in log.split('\n'):
self.execute(command, term_absent=False, write=False)
self.catch_up_successful = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment