I try to retrieve values from a MySQL database with this Python script:
import mysql.connector
from mysql.connector import errorcode
config_file = {}
try:
cnx = mysql.connector.connect(<removed.)
except mysql.connector.Error as err:
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif err.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exists")
else:
print(err)
else:
cursor = cnx.cursor()
cursor.execute("SELECT config_key, config_value FROM T_ConfigTable")
for (config_key, config_value) in cursor:
print("{}: {}".format( config_key, config_value))
config_file[config_key] = config_value
cursor.close
cnx.close
print( config_file)
But the result always comes back as:
b'value1': b'value2'
etc
How can I get rid of the b's?
I use Python 3.2
thanks for your help