python - Data is saved including blank -
i wanna parse excel , put model(city&prefecture&area&user) . wrote
fourrows_transpose=list(map(list, zip(*fourrows))) val3 = sheet3.cell_value(rowx=0, colx=9) user3 = companyransaction.objects.filter(corporation_id=val3).first() if user3: area = area.objects.filter(name="america").first() pref = prefecture.objects.create(name="prefecture", area=area) city = city.objects.create(name="city", prefecture=pref) price= price.objects.create(city=city) pref.name = fourrows_transpose[0][0] pref.save() transpose in fourrows_transpose[2:]: if len(transpose) == 5: if "×" in transpose or "○" in transpose: city.name = transpose[1] city.save() price.upper1000 = transpose[2] price.from500to1000 = transpose[3] price.under500 = transpose[4] price.save()
my ideal db in name a,a,a,a,b,b,b,b,c . rally cannot understand why such db made. think position of writing
city.name = transpose[1] city.save()
is wrong, wrote these code under price.save(),but same db made. wrong in code?how can fix this?
Comments
Post a Comment