I am exporting data from python with the csv library, which works very well. After a web search, I cannot find any information on how to format the exported data using python.
For instance. I am exporting a csv string in python like this.
for hour_record in object_list:
row = list()
for field in fields:
try:
row.append(getattr(hour_record, field))
except:
pass
writer.writerow(row)
Now I am wondering how I can pass some formatting information into a row.append call. For example, if I want to format the text in red and make sure that it is formed as a number, etc.
Does anyone know how this works?
source
share