Skip to content

Commit

Permalink
Teste para funcionamento só de uma função de leitura.
Browse files Browse the repository at this point in the history
  • Loading branch information
gguilherme42 committed Mar 21, 2020
1 parent b72c411 commit 2a55060
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
34 changes: 18 additions & 16 deletions ex115/funcionalidades/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ def pedeidade(msg='Idade: '):


def pesquisa(nome):
global arq
mnome = nome.lower()
for i, v in enumerate(lista):
for i, v in enumerate(arq):
t = v[0]
if t.lower() == mnome:
return i
Expand Down Expand Up @@ -76,20 +77,20 @@ def grava():
arquivo.close()


def leitura():
from purpurina import cores
global lista
lista = []
try:
arquivoSalvo = open('sistemasalvo.txt', 'r', encoding='utf-8')
except:
print(f'{cores("Não há arquivo.",7)}')
else:
for v in arquivoSalvo.readlines():
nome, idade = v.strip().split('-')
lista.append([nome, idade])
arquivoSalvo.close()
listagem()
# def leitura():
# from purpurina import cores
# global lista
# lista = []
# try:
# arquivoSalvo = open('sistemasalvo.txt', 'r', encoding='utf-8')
# except:
# print(f'{cores("Não há arquivo.",7)}')
# else:
# for v in arquivoSalvo.readlines():
# nome, idade = v.strip().split('-')
# lista.append([nome, idade])
# arquivoSalvo.close()
# listagem()


def outraleitura():
Expand All @@ -109,11 +110,12 @@ def outraleitura():
arquivo.close()
arquivoSalvo.close()
print(arq)
listagem()

def listagem():
from time import sleep
from purpurina import cores
global lista
global arq
sleep(0.25)
print(f'{cores("-", 4) * 30}')
for v in arq:
Expand Down
2 changes: 1 addition & 1 deletion ex115/sistema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
op = funcionalidades.menu()
if op == 1:
purpurina.escreve('LISTA')
funcionalidades.leitura()
funcionalidades.outraleitura()
elif op == 2:
purpurina.escreve('NOVO CADASTRO')
funcionalidades.novo()
Expand Down

0 comments on commit 2a55060

Please sign in to comment.