我尝试使用python& amp; _mysql lib,但是当我在我的数据库中保存特殊字符时会返回“\ xblablablablabla \ x0etc ...”
# -*- coding: utf8 -*-
import _mysql
import md5
crypt="LOLOLOLOLOLOLOLOL_I<3U"
def Create_Table():
db = _mysql.connect("localhost","Test","Password")
db.query("CREATE DATABASE Meow")
db = _mysql.connect("localhost","Test","Password","Meow")
db.query("CREATE TABLE Login(Login TEXT,Password TEXT)")
db.commit()
db.close()
def AddLogin():
Login = raw_input("Login : ")
Password = raw_input(" Password : ")
m = md5.new()
m.update(Password)
m.update(crypt)
Password = m.digest()
db = _mysql.connect("localhost","Test","Password","Meow")
db.query("INSERT INTO Membres(Login,Password) VALUES ('"+Login+"','"+Password+"'")
def Show():
db=_mysql.connect("localhost","Test","Password","Meow")
db.query("SELECT * from Login")
result = db.store_result()
result = result.fetch_row(0)
print result[0][1] # exemple
这是一个例子。