Answer the question
In order to leave comments, you need to log in
Unable to output data from .txt file. How to implement it?
here is the code
import random
file = open('passwords_dictionary.txt', 'a+')
letters = 'qwertyuiopasdfghjklzxcvbnm'
passwords = {}
while True:
mod = input('''введите 1 для генерации пароля
введите 2 для поиска пароля
введите 3 для закрытия программы
''')
if mod == '1':
password = ''
password_len = random.randint(8, 16)
for i in range(password_len):
variant = random.randint(1,3)
if variant == 1:
number = random.randint(0, 9)
password = password + str(number)
else:
letter = letters[random.randint(0, len(letters)-1)]
letters_variant =random.randint(1, 2)
if letters_variant== 1:
letter = letter.upper()
password = password + letter
print('ваш пароль:', password)
saver =input('''для сохранения пароля введите 1
введите любое другое число для отмены сохранения
''')
if saver == '1':
password_id = input('''введите имя для пароля
''')
file.write(password_id)
file.write(password)
if mod == '2':
print()
file.read()
print()
if mod == '3':
print('программа завершена')
file.close()
break
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question