Rémi Lapeyre <remi.lape...@henki.fr> added the comment:

I feel like the CSV module could support using NULL as separator and could send 
a PR with some test to add this but Daniel could you give more information 
regarding why you need explicit CSV support for this?

The CSV parser is needed to read and write CSV files to can be produced by 
other programs and has been extended to support the various dialects, most of 
them produced by spreadsheet programs.



> The use of chr(0x00) or '\0' is used quite often in the *NIX world as a 
> convenient record separator that doesn't have escaping problems because by 
> it's very nature it's non-printable. e.g. "find . -iname "*something*" 
> -print0 | xargs -0 <program>" ... 
>

> As to the difficulty in handling 0x00 characters, I dunno ... it appears that 
> GNU find, xargs, gawk...

> Is it possible to write a NUL (0x00) character to a file? Through a *NIX 
> pipe? You bet. 


Yes and all of those are supported natively by Python already:


    find . -type f -depth 1 -print0 | python -c "from pprint import pp; 
pp(input().split('\x00'))"



Multilines input can be supported as easily doing:


    data = [
        line.split('\x00')
        for line in input()
    ]


Is this not enough?

----------
nosy: +remi.lapeyre

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27580>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to