Hello, i am new to python. I need to write a function which converts a datastore data to csv format, which is downloadable. I researched upon the topic over google, got few and less info on it. The code till now is below:
def calllog_csv(self): from collections import defaultdict date = datetime.strptime('01/01/2014', '%m/%d/%Y') qry = CallLog.query().filter(CallLog.created >= date, CallLog.created <= datetime.now()).fetch() columns = defaultdict(qry) log.debug("query===>" + str(columns)) with open('calllog.csv', 'w') as csv_log: reader = csv.DictReader(csv_log) for row in reader: for (k, v) in row.items(): columns[k].append(v) log.debug("columns== from==>" + str(columns['from'])) return columns Tell me where i am wrong, or am i right? any suggestions would be helpfull. Thank you all in advance _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers