详解:
cr.dictfetchall()
will give you all the matching records in the form of the list of dictionary containing key, value [{'': ''}, {'': ''}, ...].
cr.dictfetchone()
works same as cr.dictfetchall()
except it returns only a single record {'': ''}.
cr.fetchall()
will give you all the matching records in the form of the list of tuple [(''), (''), ...].
cr.fetchone()
works same way as cr.fetchall()
except it returns only single record ('').
========================================================================
简要解释:
cr.dictfetchone return {'key':value.....}
cr.dictfetchall return [{'key':value.....},{'key':value.....}]
cr.fetchone return [value,value...]
cr.fetchall return [[value,value],[value,value]]
========================================================================例子:
In your given query, the output would be as follow:
cr.dictfetchall()
will give you[{'reg_no': 123},{'reg_no': 543},]
.cr.dictfetchone()
will give you{'reg_no': 123}
.cr.fetchall()
will give you '[(123),(543)]'.cr.fetchone()
will give you '(123)'.