你好,我赢了10个希腊。我想从mysql中获取相同的数据(文件路径)。问题是当我检索路径而不是我遇到的文件夹的名称时??????。下面是代码示例
import pymysql as MySQLdb
dbid = "client"
password = "pass"
database = "clients"
serverip = "192.168.168.150"
db = None
cur = None
try:
db = MySQLdb.connect(host=serverip, user=dbid, passwd=password, db=database, connect_timeout=20)
cur = db.cursor()
except MySQLdb.Error as e:
print("Cannot connect with the Data Base : "), e
query1 = "SELECT path FROM `instructions` WHERE clientmac ='%s'" % (str(5555))
try:
row = None
cur.execute(query1)
db.commit()
row = cur.fetchall()
except MySQLdb.Error as e:
print("Problem while Executing query :", query1, "error : ", e)
print(row)
db.close()
cur.close()
python3使用unicode,所以我认为问题不是来自python,而是来自phpmyadmin。字段路径为“utf8\u general\u ci”。一切看起来都很好,但为什么 'C:\\Users\\Γιαννης\\Documents\\Arduino'
我要走了 'C:\\Users\\???????\\Documents\\Arduino'
1条答案
按热度按时间k3bvogb11#
我找到了答案。我只想在执行查询之前进行一些额外的编码。我把代码贴在下面。