将SQL结果(mysqlconnector)转换为字符串

时间:2018-12-27 22:55:51

标签: sql python-3.x list type-conversion byte

查询搜索密码(已加密)

market cap

加密方法

mycursor = mydb.cursor()
mycursor.execute("USE continental")
sql_username = "SELECT password FROM users WHERE username ='root'"
#assword23 = "SELECT password FROM users WHERE user = %s", (username1,)
mycursor.execute(sql_username)
find_password = mycursor.fetchall() # List ?

需要将key = b'Ys_G_ziOS1AFs6X-jD3rtgsh77b3HpF7A-yiGpH-5Fg=' cipher_suite = Fernet(key) cipher_text = cipher_suite.encrypt(b"password") # Convert in byte print(cipher_text) key1 = b'Ys_G_ziOS1AFs6X-jD3rtgsh77b3HpF7A-yiGpH-5Fg=' cipher_suite1 = Fernet(key1) cipher_text1 = b'gAAAAABcHA2-58GwFxKzMzZRJsNV269_Nc-xvabFJcXV8yf0BuKI2XtD7211Vusf_hMXNrvK0glamHuoJhwPegP9iFRjXpANcg==' unciphered_text = (cipher_suite1.decrypt(cipher_text1)) print(unciphered_text) 转换为字符串才能放入

find_password

示例:

cipher_text = cipher_suite.encrypt(b"password")

我也尝试过:

test = cipher_suite.encrypt(find_password) -> "Token must be bytes"

并放入 find_password = " ".join(str(x)for x in find_password

0 个答案:

没有答案