当我执行诸如show database或show tables之类的查询时,它会以一种称为字节数组的形式显示输出。我想要正常字符串形式的输出。谁能告诉我怎么才能解决这个问题?
def tab(x,y):
x=[]
mycursor.execute("Show databases") #Selecting Database
l=list(mycursor.fetchall())
print(l)`output(bytearray(b'capital'),)(字节数组(b‘资本用户’),)(字节数组(b‘’information_schema‘),)(字节数组(b’‘mysql’),)(字节数组(b‘’performance_schema‘),)(字节数组(b’‘sys’),)
发布于 2020-07-15 09:54:41
这就是所谓的二进制字符串,只需正常转换即可。下面是如何将其转换为How to convert 'binary string' to normal string in Python3?的参考
https://stackoverflow.com/questions/62889748
复制相似问题