擅长:python、mysql、java
<p>试试这个。。。。在</p>
<pre><code>arr = []
for i in range(len(x))
arr1 = []
for m in range(len(y)):
arr1.append(DataModel(foundation=foundation, date=dates[m], price=price[m]))
#instead of appending the list, add list together to make one
arr = arr + arr1
DataModel.objects.bulk_create(arr)
</code></pre>
<p>这将产生一个可由<code>bulk_create()</code>方法处理的项目列表</p>
<p>参考号:<a href="https://stackoverflow.com/questions/2022031/python-append-vs-operator-on-lists-why-do-these-give-different-results">Python append() vs. + operator on lists, why do these give different results?</a></p>