Writing white space to CSV fields in Python?
Posted
by matt
on Stack Overflow
See other posts from Stack Overflow
or by matt
Published on 2010-05-20T04:16:47Z
Indexed on
2010/05/20
4:20 UTC
Read the original article
Hit count: 278
When I try to write a field that includes whitespace in it, it gets split into multiple fields on the space. What's causing this? It's driving me insane. Thanks
data = open("file.csv", "wb")
w = csv.writer(data)
w.writerow(['word1', 'word2'])
w.writerow(['word 1', 'word2'])
data.close()
I'll get 2 fields(word1,word2) for first example and 3(word,1,word2) for the second.
© Stack Overflow or respective owner