I have two ways to loop data, one using with for loop another with yield, I want to know what's the difference.
For Loop(get 100000 data)
data='select 100000 data from database' for d in date: do something with d
yield (get 1000 data every time,then query database 100 times)
def func(): data='select 1000 data from database' while date.count>0: yield data data = func() for d in data: do something with d