import sqlite3
import csv
conn=sqlite3.connect("D:/asdfef.xdb")
cur=conn.cursor()
cur.execute("select max(ue_rsrp) from lte_ue_rf") #sql query to calculate the avergae
rows = cur.fetchall()
columns = [i[0] for i in cur.description]
with open("D:/asdf.csv",'w') as file:
writer=csv.writer(file)
writer.writerow(columns)
writer.writerow(rows)
Above is the code used to retrieve the avg of an item in the DB, but my output shows up as a list (-79.25,). Why is this happening and what should be done to rectify this. I am a beginner with python coding
avginstead ofmaxin code? Do you get one-element list or is there something else? See also this question