When i retrieved this column and want to convert it to Json format like this:
cursor3 = conn.cursor()
cursor3.execute("select version()")
data = cursor3.fetchone()
cursor3.execute("SELECT headerdynamic FROM emailData ")
headerDynamic = cursor3.fetchall()
di = {i.split(':')[0]:i.split(':')[1] for i in headerDynamic}
js = json.dumps(di)
print(js)
It will prompt this error message:
di = {i.split(':')[0]:i.split(':')[1] for i in headerDynamic}
AttributeError: 'tuple' object has no attribute 'split'
Here is the print output of the headerDynamic
[("'header1 : Subject', 'header2 :Text'",)]
Does anyone know what im doing wrong here? Thanks