Pythoner集中营

list of lists to csv

2018-03-14  本文已影响3人  钊钖
image

a_list is a list of lists.which has already cleaned from drity.

a_list = [
[a,b,c],
[c,d,e]
]# b_list = [a,b,c]

now want change a_list to a csv file.

image

open w+b model cause a error ....sub_list is not 'str' .

if don't use the lineterminator, the new csvfile will appear empty line.

ifa_list is not list of lists is better use open wb model, that can avoide the space or empty line.

上一篇 下一篇

猜你喜欢

热点阅读