slides10-ex2.py
File contents
import os
f = open("pessoas.txt", "r")
dic = {}
for linha in f:
pos = linha.find(" ")
identidade = linha[:pos]
nome = linha[pos+1:-1]
dic[identidade] = nome
pasta = os.getcwd()
print "Pasta atual: "+ pasta
f.close()
print dic
for chave, valor in dic.iteritems():
print "Identidade: %s\tNome: %s"%(chave, valor)
Click here to get the file