编程语言
首页 > 编程语言> > python 打印数组中文显示为‘\xe6\xb5\x8b\xe8\xaf\x95\xe4\xb8\xbb\xe6\x9c\xba‘’

python 打印数组中文显示为‘\xe6\xb5\x8b\xe8\xaf\x95\xe4\xb8\xbb\xe6\x9c\xba‘’

作者:互联网

# !/usr/bin/env python
# -*- coding: utf-8 -*-
import cx_Oracle
from pprint import pprint
import csv
import time
import re
import binascii

conn = cx_Oracle.connect('system/oracle@192.168.137.2/serv')
cursor = conn.cursor()
xsql='select * from tlcb_mon_device'
r = cursor.execute(xsql)
print r
arr=[]
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 arr
print type(arr)
for x in arr:
    print x


C:\Python27\python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/Django/a21.py
<cx_Oracle.Cursor on <cx_Oracle.Connection to system@192.1

标签:arr,utf,x95,python,len,x8b,xe6,print,import
来源: https://blog.csdn.net/zhaoyangjian724/article/details/78320276