Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os.path
- saveName = "girlfriend-save.txt"
- # checks to see if the save file is on disk.
- def saveExists():
- return os.path.isfile(saveName)
- # loads the stored name from the save, if possible
- def loadSave():
- f = open(saveName)
- lines = f.readlines()
- if len(lines) < 1:
- print "Save file has no data!"
- return promptNewName()
- else:
- return lines[0]
- # prompts for a new name and returns it.
- def promptNewName():
- while True:
- print "What should my name be?"
- s = str(raw_input())
- if len(s) < 1:
- print "Well you have to call me something!"
- else:
- return s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement