Make print a function in documentation
This commit is contained in:
parent
8f4cd59c9a
commit
5f2c0193b8
@ -238,7 +238,7 @@ class Database(object):
|
|||||||
|
|
||||||
res = db.query('SELECT user, COUNT(*) c FROM photos GROUP BY user')
|
res = db.query('SELECT user, COUNT(*) c FROM photos GROUP BY user')
|
||||||
for row in res:
|
for row in res:
|
||||||
print row['user'], row['c']
|
print(row['user'], row['c'])
|
||||||
"""
|
"""
|
||||||
return ResultIter(self.executable.execute(query, **kw))
|
return ResultIter(self.executable.execute(query, **kw))
|
||||||
|
|
||||||
|
|||||||
@ -403,6 +403,6 @@ class Table(object):
|
|||||||
::
|
::
|
||||||
|
|
||||||
for row in table:
|
for row in table:
|
||||||
print row
|
print(row)
|
||||||
"""
|
"""
|
||||||
return self.all()
|
return self.all()
|
||||||
|
|||||||
@ -71,7 +71,7 @@ When dealing with unknown databases we might want to check their structure
|
|||||||
first. To start exploring, let's find out what tables are stored in the
|
first. To start exploring, let's find out what tables are stored in the
|
||||||
database:
|
database:
|
||||||
|
|
||||||
>>> print db.tables
|
>>> print(db.tables)
|
||||||
set([u'user', u'action'])
|
set([u'user', u'action'])
|
||||||
|
|
||||||
Now, let's list all columns available in the table ``user``:
|
Now, let's list all columns available in the table ``user``:
|
||||||
@ -81,7 +81,7 @@ Now, let's list all columns available in the table ``user``:
|
|||||||
|
|
||||||
Using ``len()`` we can get the total number of rows in a table:
|
Using ``len()`` we can get the total number of rows in a table:
|
||||||
|
|
||||||
>>> print len(db['user'])
|
>>> print(len(db['user']))
|
||||||
187
|
187
|
||||||
|
|
||||||
Reading data from tables
|
Reading data from tables
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user