Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def privestvie():
- filename = 'polzovatel.json'
- try:
- with open(filename) as file:
- username = json.load(file)
- except FileNotFoundError:
- return None
- else:
- return username
- def sozdanie():
- filename = 'polzovatel.json'
- username = input('Введите ваше имя: ')
- with open(filename, 'w') as file:
- json.dump(username,file)
- return username
- def vivod():
- a = privestvie()
- if a:
- print('С возвращением, ' + a )
- else:
- a = sozdanie()
- print('Мы вас запомнили, ' + a)
- vivod()
Advertisement
Add Comment
Please, Sign In to add comment