Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- def SignUp():
- username = input('please enter username: ')
- filename = username + '.txt'
- if os.path.exists(filename):
- print('Username already exists, please choose another one: ')
- SignUp()
- else:
- password = input('please enter password: ')
- file = open(filename, 'w')
- file.write(password)
- file.close()
- def SignIn():
- username = input('username: ')
- password = input('password: ')
- filename = username + '.txt'
- try:
- file = open(filename, 'r')
- savepassword = file.read().rstrip()
- file.close()
- if savepassword == password:
- print('Signing in....')
- print('Success')
- else:
- print('Wrong password...')
- except FileNotFoundError:
- print('No such username exists!')
- # Program Start Here
- SignUp()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement