我该怎么做:
reader = csv.reader(open(file_path, 'rb').read().splitlines(), delimiter=";")
p = Product()
for key, row in enumerate(reader):
f = request.POST.get('select_%s' % key) // ex. productname
p.f = row[key] // HOW TO?, p.f should be "productname" from the variable
希望你能帮助我!你知道吗
使用
setattr
在运行时基于名称设置对象的属性:相关问题 更多 >
编程相关推荐