[Python-ideas] os.path.isbinary

Ryan rymg19 at gmail.com
Fri Aug 2 01:53:56 CEST 2013


I see...
This works:

import re

with open('test.xml', 'r') as f:
    print re.sub(r'(^(\'|\")|(\'|\")$)', '', repr(f.read()).replace('\\n', '\n'))

But, repr can still print binary characters. Opening libexpat.so shows all sorts of crazy characters like \x00.

random832 at fastmail.us wrote:

>On Thu, Aug 1, 2013, at 16:05, David Mertz wrote:
>> In what sense is "\n" "not printable in repr()"?!
>
>Because it prints as \n instead of as itself, doesn't it? Or is that
>only in Python 2?
>_______________________________________________
>Python-ideas mailing list
>Python-ideas at python.org
>http://mail.python.org/mailman/listinfo/python-ideas

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130801/6d5c6e84/attachment.html>


More information about the Python-ideas mailing list