-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinsert_user_roots.py
More file actions
36 lines (29 loc) · 912 Bytes
/
insert_user_roots.py
File metadata and controls
36 lines (29 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# coding: utf-8
def insert_user_roots(index_option):
"""Recebe diretórios raízes e os armazena em uma lista."""
user_roots = []
# limpa a lista para evitar redundâncias
user_roots.clear()
option = ("ENCRIPTADO", "DECRIPTADO")
# leitura e adição de raízes em uma lista para encriptar ou decriptar
while True:
try:
roots = str(input(f"\nInsira o diretório raiz a ser {option[index_option]}: "))
except (KeyboardInterrupt, EOFError, Exception):
print("\n[ ? ] Entrada Inválida..")
continue
else:
user_roots.append(roots)
while True:
try:
answer = str(input("Deseja inserir mais diretórios? [S/N]: ")).upper().strip()[0]
except (KeyboardInterrupt, EOFError, Exception):
print("\n[ ? ] Entrada Inválida..")
else:
if answer in "SN":
break
else:
print("\nOpção inválida. Apenas [S/N].")
if answer == "N":
break
return user_roots