python 操作MYSQL,python操作mysql,sl.py#coding
python 操作MYSQL,python操作mysql,sl.py#coding
sl.py
#coding=utf-8###################################################qq:316118740#BLOG:http://hi.baidu.com/alalmn##################################################"""*****python MySQL*****"""import MySQLdbdef select(): conn=MySQLdb.connect(host="localhost",user="root",passwd="316118740",db="urldata",charset="utf8") cursor = conn.cursor() n = cursor.execute("select * from url") cursor.scroll(0) for row in cursor.fetchall(): print row[0] print row[1] print row[2] conn.close()def usage(): print __doc__ select()if __name__=='__main__': usage()
未命名.jpg
imgs/asCode/26083516_87UJ.jpg
评论关闭