我正在寻找更“美丽”的东西来做我正在做的事情。现在工作得很好。
f = open(pathdata+'blocoh2.csv', 'r')
reader = csv.reader(f)
for row in reader:
dpt, created = Departamento.objects.get_or_create(name = row[3])
print str(created) + "dprmentp"
blc, created = Bloco.objects.get_or_create(nm_andar = row[5],name = row[6])
print str(created) + "bloco"
tplugar, created = TipoLugar.objects.get_or_create(name = (smart_str(row[2])))
print str(created) + "tipo_lugar"
lugar, created = Lugar.objects.get_or_create(name=row[0], utilizacao=row[1],
tipoLugar = tplugar,
metragem = 0,
coordx = 0,
coordy = 0,
bloco = blc,
departamento = dpt)
print str(created) + "lugar"
提前致谢