【正文】
er than your own custom dictionarybased approach or even a db_row based solution. Row對象的詳細(xì)介紹class A Row instance serves as a highly optimized row_factory for Connection objects. It tries to mimic a tuple in most of its features.It supports mapping access by column name and index, iteration, representation, equality testing and len().If two Row objects have exactly the same columns and their members are equal, they pare equal.Changed in version : Added iteration and equality (hashability).keys()This method returns a tuple of column names. Immediately after a query, it is the first member of each tuple in .New in version . 下面舉例說明In [30]: = In [31]: c = ()In [32]: (39。select * from catalog39。)Out[32]: object at 0x05666680In [33]: r = ()In [34]: type(r)Out[34]: type 39。39。In [35]: rOut[35]: object at 0x05348980In [36]: print r(0, 10, u39。\u9c7c39。, u39。Yu39。)In [37]: len(r)Out[37]: 4In [39]: r[2] 使用索引查詢Out[39]: u39。\u9c7c39。In [41]: ()Out[41]: [39。id39。, 39。pid39。, 39。name39。, 39。nickname39。]In [42]: for e in r: ....: print e, ....: 0 10 魚 Yu 使用列的關(guān)鍵詞查詢In [43]: r[39。id39。]Out[43]: 0In [44]: r[39。name39。]Out[44]: u39。\u9c7c39。歡迎您的光臨,!希望您提出您寶貴的意見,你的意見是我進(jìn)步的動力。贈語; 如果我們做與不做都會有人笑,如果做不好與做得好還會有人笑,那么我們索性就做得更好,來給人笑吧! 現(xiàn)在你不玩命的學(xué),以后命玩你。我不知道年少輕狂,我只知道勝者為王。不要做金錢、權(quán)利的奴隸;應(yīng)學(xué)會做“金錢、權(quán)利”的主人。什么時候離光明最近?那就是你覺得黑暗太黑的時候。最值得欣賞的風(fēng)景,是自己奮斗的足跡。壓力不是有人比你努力,而是那些比你牛幾倍的人依然比你努力。 參考