Perl to Python using MqSQLdb

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Wed Aug 13 07:05:20 EDT 2008


-On [20080812 15:16], Daniel Mahoney (dan at catfolks.net) wrote:
>cursor=db.cursor()
>cursor.execute(sql)
>while (1):
>	row = cursor.fetchone()
>	if row == None:
>		break
>	combined = ', '.join(row)

Why not something like:

for row in cursor.fetchall():
    combined = ', '.join(row)

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B
Focus on your one purpose...



More information about the Python-list mailing list