[Tutor] mapping list appends to correct position for csv output
Alan Gauld
alan.gauld at btinternet.com
Tue Nov 13 12:42:36 CET 2012
On 13/11/12 09:50, Norman Khine wrote:
> also which is more efficient:
>
> c.writerow(adm_product) # writing the product to the csv when all the
> fileds are found
>
> or
>
> products = [] # adding them to a list first and then writing them to the csv
> products.append(adm_product)
> c.writerow(x) for x in products
Don't guess, measure. Write a small test and compare.
timeit is your friend.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list