Apr-07-2022, 12:13 PM
Hi all, I have this wuery output that I want to write to a text file. But it is writeen with "(" and "'" and I want it clear.
From database I have this output:
NAME
------------------------------
DATA
RECO
My python code is like this:
DATA
RECO
I don't knwo if I need to convert it to string. I tried using STR but didn't work.
From database I have this output:
NAME
------------------------------
DATA
RECO
My python code is like this:
import cx_Oracle as oracledb
import xml.etree.ElementTree as ET
conn = oracledb.connect("/", mode=oracledb.SYSASM)
#prev_name = None
cursor = conn.cursor()
cursor.execute("select distinct name from v$asm_diskgroup")
for dgname in cursor:
xml_data_cell=dgname
print(dgname)
print(type(dgname))Output from python is : ('DATAC3',)
<type 'tuple'>
('RECOC3',)
<type 'tuple'>
>>>And text file generated is : cat /tmp/dgnames
('DATA',)('RECO',)I want this file with something like: DATA
RECO
I don't knwo if I need to convert it to string. I tried using STR but didn't work.
