Snippets Collections
#!/usr/bin/python



-- coding: UTF-8 --


pip install MySQL-python



import MySQLdb, os




try:
    conn = MySQLdb.connect(host='172.17.42.1', user='my_email', passwd='normal', db='database', port=3306)




cur = conn.cursor()
cur.execute('SELECT `id`, `name`, `path`, FROM `doc_file`')

# results
resulsts=cur.fetchall()    id, name, path = r[0], r[1], r[2]

    if path and not os.path.exists(path):
        print 'file not exist: ', id, name, path, flashpath

cur.close()
conn.close()

 



except MySQLdb.Error,e:
     print "Mysql Error %d: %s" % (e.args[0], e.args[1])




</pre> 

 

 



                    
 
star

Fri Mar 03 2023 02:59:12 GMT+0000 (Coordinated Universal Time) https://www.open-open.com/code/view/1457829300325

#python #mysql #database #thirdparty

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension