Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- import os
- def main():
- my_dict = {}
- count = 0
- time = datetime.datetime.now().strftime("%a, %d %B %Y %H:%M:%S")
- print(time)
- userCount = float(input("How many members are being logged?: "))
- while count < userCount:
- member = input("Enter desired member login: ")
- password = input("Enter desired password [DIGITS ONLY!]: ")
- while not password.isdigit():
- print('Invalid Password!')
- password = input("Enter desired password [DIGITS ONLY!]: ")
- userInfo = member+','+password+'\n'
- myfile = open('myfile.txt','a')
- myfile.write(userInfo)
- count += 1
- myfile.close()
- myfile = open('myfile.txt','r')
- for line in myfile.readlines():
- line = line.split(',')
- key = line[0].strip()
- value = line[1].strip()
- my_dict[key] = value
- logger(my_dict,time,key,value)
- def logger(my_dict,time,key,value):
- userSearch = input("Search for a user: ")
- if userSearch in my_dict.keys():
- print("User Found!")
- login = input("Do you want to login into the given user? [y/n]: ")
- if login == 'y':
- password = input('Enter Password: ')
- if password == my_dict.get(userSearch,value):
- print('\n')
- print(time)
- print("Welcome!")
- input("Press any key to quit example.") #to keep open until any key pressed
- else:
- print("Incorrect Password!")
- else:
- logger()
- else:
- print("User Not Found!")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement