> well, one would have the same problem with commas...

No, because a long string that contains commas is surrounded by "...".
Now, you tell me that it becomes a problem if you have " characters in
the message? No, because it becomes "" (see
http://trac.sagemath.org/ticket/19149?format=csv)

This being said, you don't even have to deal with this yourself, as
Python does it well already. The following (working) example encodes
in csv a table whose cells contains both " and , characters.

Nathann

import csv
tricky_table = [["A", "b\"\",\"Whatever,,,"],
                ["\"Lalala,\"\"\",,,,,", "HeyHey\"\",,"]]

with open("/tmp/test","w") as f:
    w = csv.writer(f)
    w.writerows(tricky_table)

with open("/tmp/test","r") as f:
    tw = list(csv.reader(f))

assert tw == tricky_table

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to