V
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/bin/python
import MySQLdb as mdb
con = mdb.connect('localhost', 'root', 'pass@123', 'workbench');
with con:
cur = con.cursor()
cur.execute("SELECT descrip FROM table LIMIT 1")
rows = cur.fetchall()
for row in rows:
row_new = row[0].split("\n", " ")
row = "".join(row_new)
print row
exit(0)
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/bin/python
import MySQLdb as mdb
con = mdb.connect('localhost', 'root', 'pass@123', 'workbench');
with con:
cur = con.cursor()
cur.execute("SELECT descrip FROM table LIMIT 1")
rows = cur.fetchall()
for row in rows:
row_new = row[0].split("\n", " ")
row = "".join(row_new)
print row
exit(0)