0
I made a program that reads a file but it reads and already closes, how to add a 'Press S to exit' for example and leave the print on the screen for longer? -below is the code
lista=open('item.txt','r')
for linha in lista
itens=linha.split()
print('Comprar', itens[0])
linha=lista.readline()
lista.close()
Cara valeu implementei aqui, but now the code ta giving output only the first line of the file now :/ could help me?
– Brenno
Try to remove the list.close() out of the if , leaving it below this line.
linha=lista.readline() lista.close()
– Robson Silva