# !/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('tlcbuser/tlcbuser@10.5.100.232/tlyy')
cursor = conn.cursor()
xsql="select * from tlcb_mon_device a where a.ipaddr='10.3.244.1'"
r = cursor.execute(xsql)
print r
arr=[]
for x in r:
print x
C:\Python27\python.exe C:/Users/tlcb/PycharmProjects/untitled/a6.py
<cx_Oracle.Cursor on <cx_Oracle.Connection to tlcbuser@10.5.100.232/tlyy>>
('DP_244.1', 'IBM AIX', '10.3.244.1', 'UTF-8', '\xb5\xe7\xc6\xb1\xc7\xb0\xd6\xc3\xd6\xf7\xbb\xfa', 'ECDS', '\xc2\xde\xba\xaf', '1', 'FTP')
# !/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('tlcbuser/tlcbuser@10.5.100.232/tlyy')
cursor = conn.cursor()
xsql="select * from tlcb_mon_device a where a.ipaddr='10.3.244.1'"
r = cursor.execute(xsql)
print r
arr=[]
for x in r:
print x
print x[6]
print len(x[6])
C:\Python27\python.exe C:/Users/tlcb/PycharmProjects/untitled/a6.py
<cx_Oracle.Cursor on <cx_Oracle.Connection to tlcbuser@10.5.100.232/tlyy>>
('DP_244.1', 'IBM AIX', '10.3.244.1', 'UTF-8', '\xb5\xe7\xc6\xb1\xc7\xb0\xd6\xc3\xd6\xf7\xbb\xfa', 'ECDS', '\xc2\xde\xba\xaf', '1', 'FTP')
???
4
# !/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('tlcbuser/tlcbuser@10.5.100.232/tlyy')
cursor = conn.cursor()
xsql="select * from tlcb_mon_device a where a.ipaddr='10.3.244.1'"
r = cursor.execute(xsql)
print r
arr=[]
for x in r:
print x
print x[6]
print len(x[6])
print type(x[6])
print x[6].decode('gbk')
print len(x[6].decode('gbk'))
print x[6].decode('gbk').encode('utf-8')
print len(x[6].decode('gbk').encode('utf-8') )
C:\Python27\python.exe C:/Users/tlcb/PycharmProjects/untitled/a6.py
<cx_Oracle.Cursor on <cx_Oracle.Connection to tlcbuser@10.5.100.232/tlyy>>
('DP_244.1', 'IBM AIX', '10.3.244.1', 'UTF-8', '\xb5\xe7\xc6\xb1\xc7\xb0\xd6\xc3\xd6\xf7\xbb\xfa', 'ECDS', '\xc2\xde\xba\xaf', '1', 'FTP')
???
4
<type 'str'>
测试
2
测试
6
Process finished with exit code 0
python \xb5\xe7\xc6\xb1\xc7\xb0\xd6\xc3\xd6\xf7\xbb\xfa
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
cx_Oracle模块介绍
Python访问Oracle, 首选cx_Oracle模块, 功能十分强劲! #==========================# 下载cx_Oracle源
数据库 操作系统 python oracle bc -
linux环境下cx_Oracle的“ImportError: No module named cx_Oracle”错误。
环境:redhat AS + python2.7 + ml 我下载的是:ora...
Oracle Linux Python RedHat .net -
【Python】cx_Oracle :pip install cx_Oracle 安装失败
python链接Oracle时,安装 cx_Oracle报错解决方法 ...
Python oracle python 数据 sql