On Jan 10, 6:37 am, Νικόλαος Κούρας <nikos.kou...@gmail.com> wrote: > On 10 Ιαν, 12:57, Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5- > > > > > > > > > > a470-7603bd3aa...@spamschutz.glglgl.de> wrote: > > Am 10.01.2012 10:02 schrieb Νικόλαος Κούρας: > > > > ----------------------------------------------- > > > | HOST | HITS | AGENT | DATE | > > > ----------------------------------------------- > > > | foo | 7 | IE6 | 1/1/11 | > > > ----------------------------------------------- > > > | bar | 42 | Firefox | 2/2/10 | > > > ----------------------------------------------- > > > | baz | 4 | Chrome | 3/3/09 | > > > ----------------------------------------------- > > > > In this line: > > > for host, hits, agent, date in dataset: > > > > 'dataset' is one of the rows of the mysql result or the whole mysql > > > result set like the table above? > > > dataset is a cursor, representing the whole result set. > > > Iterating over it produces one row at each iteration step: > > > for row in dataset: > > ... > > > As each row consists of 4 fields, one iteration result is a tuple of 4 > > elements. > > > In this case, > > > for host, hits, agent, date in dataset: > > So that means that > > for host, hits, agent, date in dataset: > > is: > > for host, hits, agent, date in (foo,7,IE6,1/1/11) > > and then: > > for host, hits, agent, date in (bar,42,Firefox,2/2/10) > > and then: > > for host, hits, agent, date in (baz,4,Chrome,3/3/09) > > So 'dataset' is one row at each time? > but we said that 'dataset' represent the whole result set. > So isnt it wrong iam substituting it with one line per time only?
It maps naturally to a phrase 'for page in a book'. Book refers to a complete book with all pages, but 'for page in a book' refers to each page, one by one. 'for each page in book: turn it'. The meaning is to turn each page, so your question is equivalent to asking 'so book is one page at each time'? No, it is not and doesn't have to be (unless it's a really short book!) -ak -- http://mail.python.org/mailman/listinfo/python-list