diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2009-09-13 08:09:56 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2009-09-13 08:09:56 (GMT) |
commit | f388053649111e08ac213c0073cc60f02790351a (patch) | |
tree | 4d2dae9331d78f64d5e18a362d4e74d140a52156 /Doc | |
parent | 2befd9a34c2de6a35aa9ea0f2e63f6cfaeed923b (diff) | |
download | cpython-f388053649111e08ac213c0073cc60f02790351a.zip cpython-f388053649111e08ac213c0073cc60f02790351a.tar.gz cpython-f388053649111e08ac213c0073cc60f02790351a.tar.bz2 |
Merged revisions 74763 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r74763 | ezio.melotti | 2009-09-13 08:49:25 +0300 (Sun, 13 Sep 2009) | 1 line
small fixes in the examples and in the markup
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/sqlite3.rst | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index a4d9c7f..74bbb53 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -79,12 +79,12 @@ This example uses the iterator form:: >>> c = conn.cursor() >>> c.execute('select * from stocks order by price') >>> for row in c: - ... print(row) + ... print(row) ... - (u'2006-01-05', u'BUY', u'RHAT', 100, 35.14) - (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0) - (u'2006-04-06', u'SELL', u'IBM', 500, 53.0) - (u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0) + ('2006-01-05', 'BUY', 'RHAT', 100, 35.14) + ('2006-03-28', 'BUY', 'IBM', 1000, 45.0) + ('2006-04-06', 'SELL', 'IBM', 500, 53.0) + ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.0) >>> @@ -589,18 +589,19 @@ Now we plug :class:`Row` in:: <sqlite3.Cursor object at 0x7f4e7dd8fa80> >>> r = c.fetchone() >>> type(r) - <type 'sqlite3.Row'> - >>> r - (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14) + <class 'sqlite3.Row'> + >>> tuple(r) + ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) >>> len(r) 5 >>> r[2] - u'RHAT' + 'RHAT' >>> r.keys() ['date', 'trans', 'symbol', 'qty', 'price'] >>> r['qty'] 100.0 - >>> for member in r: print member + >>> for member in r: + ... print(member) ... 2006-01-05 BUY @@ -647,7 +648,7 @@ This is how SQLite types are converted to Python types by default: +=============+=============================================+ | ``NULL`` | :const:`None` | +-------------+---------------------------------------------+ -| ``INTEGER`` | :class`int` | +| ``INTEGER`` | :class:`int` | +-------------+---------------------------------------------+ | ``REAL`` | :class:`float` | +-------------+---------------------------------------------+ |