Re: MySQLdb Help

2013-09-17 Thread Ervin Hegedüs
Hello, On Tue, Sep 17, 2013 at 07:22:50PM +1000, Ben Finney wrote: > Ervin Hegedüs writes: > > > Hello, > > > > On Tue, Sep 17, 2013 at 05:35:30PM +1000, Ben Finney wrote: > > > for row in cur.fetchall(): > > > > and what if in body of iteration there is another fetchall()? :) > > Yes, what

Re: MySQLdb Help

2013-09-17 Thread Ben Finney
Ervin Hegedüs writes: > Hello, > > On Tue, Sep 17, 2013 at 05:35:30PM +1000, Ben Finney wrote: > > for row in cur.fetchall(): > > and what if in body of iteration there is another fetchall()? :) Yes, what if? Each call to ‘fetchall’ returns a sequence of rows. I don't see your point. -- \

Re: MySQLdb Help

2013-09-17 Thread Ervin Hegedüs
Hello, On Tue, Sep 17, 2013 at 05:35:30PM +1000, Ben Finney wrote: > Venkat Addala writes: > > > rows = cur.fetchall() > > for row in rows: > > You never use ‘rows’ for anything else, so you may as well forget it and > just iterate directly over the return value:: > > for row in cur.fe

Re: MySQLdb Help

2013-09-17 Thread Ervin Hegedüs
Hello, On Tue, Sep 17, 2013 at 12:43:20PM +0530, Venkat Addala wrote: > Hi all, > > > I'm new to python, i am connecting mysql database with python. now i want > to do sanitation on the database, like to remove "\n", extra spaces blah > blah.. and update it back to mysql database. i was trying

Re: MySQLdb Help

2013-09-17 Thread Venkat Addala
hey Ben, Thanks for your solution, i am done with this before, now i'm having problem after deleting \n and extra spaces, i want to update it back it again to mysql db. For this i tried using regular expression check this code; # -*- coding: utf-8 -*- import re import MySQLdb pattern = re.comp

Re: MySQLdb Help

2013-09-17 Thread Ben Finney
Venkat Addala writes: > I'm new to python Welcome! Congratulations on choosing Python for programming. > i am connecting mysql database with python. now i want to do > sanitation on the database, like to remove "\n", extra spaces blah > blah.. and update it back to mysql database. > i was t

MySQLdb Help

2013-09-17 Thread Venkat Addala
Hi all, I'm new to python, i am connecting mysql database with python. now i want to do sanitation on the database, like to remove "\n", extra spaces blah blah.. and update it back to mysql database. i was trying somthing, here is my code, can you please provide me solution for this.. #!/usr/b