开发者

how do write a list of string into a csv file in python?

开发者 https://www.devze.com 2023-03-30 20:31 出处:网络
I have a list of strings with开发者_Python百科 spaces, periods, commas and semi colons and I\'m wondering how do I get these into a csv file? I need each list of strings to correspond to one line.with

I have a list of strings with开发者_Python百科 spaces, periods, commas and semi colons and I'm wondering how do I get these into a csv file? I need each list of strings to correspond to one line.


with open('my.csv', 'w') as handle:
    handle.write('\n'.join(list_of_strings))

? We need more info on your "list of strings" to know if you need to do any more than that.


Did you have a look to the csv module (especially the examples part )?

0

精彩评论

暂无评论...
验证码 换一张
取 消