Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Created on Sat Oct 7 14:38:02 2017
- @author: Owner
- """
- userName = {}
- '''
- readLinesFile = open('rLines.txt','wt')
- stringTest = 'test'
- readLinesFile.write(stringTest)
- readLinesFile.close()
- inFile = open('rLines.txt','rt')
- print(inFile.read())
- '''
- def testInt(Num):
- try:
- int(Num)
- return True
- except:
- return False
- def addUser():
- while True:
- global userName
- newUserFile = open('rLines.txt','rt')
- fileVar = newUserFile.readlines()
- print (fileVar)
- newUserFile.close()
- userInpName = input('please name your user')
- passWord = input('please make a password')
- userName[userInpName] = passWord
- print(userName)
- userFile = open('rLines.txt','a+')
- userFile.write(str(userName))
- userFile.close()
- return userChoice()
- def findUser(userInp,passInp):
- global userName
- while True:
- print(userInp,passInp,userName)
- if userInp in userName.keys():
- if userName[userInp][0] == passInp:
- print('that is correct')
- return userChoice()
- else:
- print('please return to the menu to select a different option')
- return userChoice()
- else:
- print('this is if userinp isnt in username.keys()')
- return userChoice()
- def userChoice():
- userUser = input('please input your choice to \n1.) add a new user\n2.) select an existing user')
- if testInt(userUser):
- if userUser == '1':
- return addUser()
- elif userUser == '2':
- userName = input('please input your username')
- passWord = input('please input your password')
- return findUser(userName,passWord)
- else:
- print('that is not a valid number, please try again')
- return userChoice()
- else:
- print('that is not a number please try again')
- return userChoice()
- userChoice()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement