In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
# / usr/bin/env python#__*__coding:utf8__*__zbx_host = '10.1.12.100'zbx_port = 3306zbx_username =' zabbix'zbx_password = '123456'zbx_dbname =' zabbix'groupname = 'other departments' conn = MySQLdb.connect (host = zbx_host,port = zbx_port,user = zbx_username, passwd = zbx_password Db = zbx_dbname) cursor = conn.cursor () sql =''select groupid from groups where name='%s'% groupnamecursor.execute (sql) print cursor.fetchall ()
When groupname = 'other departments', the data has not been found and has been empty all the time, but there is data when groupname = 'templates'. I think it does not support Chinese, and the database itself is encoded in utf8.
Plagiarized the post written by the great god for a while.
Found that the MySQLdb plug-in should also declare when connecting, not long to use Chinese to write scripts, has not been found.
Conn = MySQLdb.connect (host = zbx_host,port = zbx_port,user = zbx_username, passwd = zbx_password,db = zbx_dbname,charset = "utf8")
Just add a parameter. It's been going on for a long time.
Reference:
Http://blog.csdn.net/dszgf5717/article/details/50985816
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.