python 打印数组中文显示为'\xe6\xb5\x8b\xe8\xaf\x95\xe4\xb8\xbb\xe6\x9

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               
# !/usr/bin/env python# -*- coding: utf-8 -*-import cx_Oraclefrom pprint import pprintimport csvimport timeimport reimport binasciiconn = cx_Oracle.connect('system/[email protected]/serv')cursor = conn.cursor()xsql='select * from tlcb_mon_device'r = cursor.execute(xsql)print rarr=[]for x in r:    print x    print x[0]    print len(x[0])    #print x[1]    print x[1].decode('gbk').encode('utf-8')    print len(x[1])    y=x[1].decode('gbk').encode('utf-8')    print len(y)    print  type(x)    arr.append(x[0])    arr.append(y)print '-------------------------------------------------------------------------------------------------'print arrprint type(arr)for x in arr:    print xC:\Python27\python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/Django/a21.py<cx_Oracle.Cursor on <cx_Oracle.Connection to system@192.168.137.2/serv>>('192.168.137.3', '\xb2\xe2\xca\xd4\xd6\xf7\xbb\xfa')192.168.137.313测试主机812<type 'tuple'>('192.168.137.4', '\xc9\xfa\xb2\xfa\xd6\xf7\xbb\xfa')192.168.137.413生产主机812<type 'tuple'>-------------------------------------------------------------------------------------------------['192.168.137.3', '\xe6\xb5\x8b\xe8\xaf\x95\xe4\xb8\xbb\xe6\x9c\xba', '192.168.137.4', '\xe7\x94\x9f\xe4\xba\xa7\xe4\xb8\xbb\xe6\x9c\xba']<type 'list'>192.168.137.3测试主机192.168.137.4生产主机Process finished with exit code 0python 显示为\xe6\xb5\x8b\xe8\xaf\x95\xe4\xb8\xbb\xe6\x9c\xba,实际取出后正常。

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

你可能感兴趣的:(python 打印数组中文显示为'\xe6\xb5\x8b\xe8\xaf\x95\xe4\xb8\xbb\xe6\x9)