我在让这段代码工作时遇到了一些麻烦:
count_bicycleadcategory = 0
for item_bicycleadcategory in some_list_with_integers:
exec 'model_bicycleadcategory_%s.bicycleadcategorytype = BicycleAdCategoryType.objects.get(pk=' + str(item_bicycleadcategory) + ')' % count_bicycleadcategory
count_bicycleadcategory = count_bicycleadcategory + 1
我收到一个错误:
Type Error, not all arguments converted during string formatting
我的问题是:关于如何将“item_bicycleadcategory”传递给 exec 表达式的任何线索?
最好的祝福,