Advertisement
raphtlw

Untitled

Oct 19th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. # first time setup configuration
  2. try:
  3.     setup = open('data/setup.txt', 'r')
  4. except IOError:
  5.     setdata = open('data/setup.txt', 'w')
  6.     setdata.write('false')
  7.     setdata.close()
  8.     setup = open('data/setup.txt', 'r')
  9.  
  10. found = False
  11.  
  12. for line in setup:
  13.     if 'true' in line:
  14.         found = True
  15. setup.close()
  16.  
  17. # what to do for first time use
  18. print('First time setup!')
  19. output = input('\nDestination to save your files in: ')
  20.  
  21. if not found:  # if found = false
  22.     setdata = open('data/setup.txt', 'w')
  23.     setdata.write('true')
  24.     setdata.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement