Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import os.path
  2.  
  3. saveName = "girlfriend-save.txt"
  4.  
  5. # checks to see if the save file is on disk.
  6. def saveExists():
  7. return os.path.isfile(saveName)
  8.  
  9. # loads the stored name from the save, if possible
  10. def loadSave():
  11. f = open(saveName)
  12. lines = f.readlines()
  13. if len(lines) < 1:
  14. print "Save file has no data!"
  15. return promptNewName()
  16. else:
  17. return lines[0]
  18.  
  19. # prompts for a new name and returns it.
  20. def promptNewName():
  21. while True:
  22. print "What should my name be?"
  23. s = str(raw_input())
  24. if len(s) < 1:
  25. print "Well you have to call me something!"
  26. else:
  27. return s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement