slides10-ex2-linhas-enumeradas.txt
File contents
1 import os
2 f = open("pessoas.txt", "r")
3 dic = {}
4 for linha in f:
5 pos = linha.find(" ")
6 identidade = linha[:pos]
7 nome = linha[pos+1:-1]
8 dic[identidade] = nome
9 pasta = os.getcwd()
10 print "Pasta atual: "+ pasta
11 f.close()
12
13 print dic
14 for chave, valor in dic.iteritems():
15 print "Identidade: %s\tNome: %s"%(chave, valor)
16
Click here to get the file