Στις 10 Ιανουαρίου 2012 1:42 π.μ., ο χρήστης Ian Kelly < ian.g.ke...@gmail.com> έγραψε:
> > > b) In the 2nd example we have for 'host, hits, agent, date in > > dataset'. How does these 4 variables take their values out of dataset? > > How dataset is being splitted? > > The second example works the same way as the first, except that > instead of storing each row tuple in a single variable called row, it > unpacks each tuple into four different variables named 'host', 'hits', > 'agent', and 'date'. These represent the values of the selected > columns from the query, for each selected row. > > if the MySQL query was: cursor.execute( '''SELECT host, hits, agent, date FROM visitors WHERE pin = %s ORDER BY date DESC''', pin ) can you help me imagine how the mysql database cursor that holds the query results would look like? I must somehow visualize it in order to understand it! Also what happend if the query was: cursor.execute( '''SELECT host FROM visitors") ? the result would have to be something likelike? ----------------- |somehost1| ----------------- |somehost2| ----------------- |somehost3| ----------------- ..................... ..................... |somehost n| ----------------- So what values host, hits, agent, date would have in 'for host, hits, agent, date in dataset' ? Every row has one string how can that be split in 4? Excuse my english.
-- http://mail.python.org/mailman/listinfo/python-list