1.AttributeError: 'str' object has no attribute 'decode'
query = query.decode(errors='replace')
解决:
python3里面,字符串要先encode手动指定其为某一编码的字节码之后,才能decode解码。