non printable (moving away from Perl)

Fillmore fillmore_remove at hotmail.com
Fri Mar 11 14:36:06 EST 2016


On 3/11/2016 2:23 PM, MRAB wrote:
> On 2016-03-11 00:07, Fillmore wrote:
>>
>> Here's another handy Perl regex which I am not sure how to translate to
>> Python.
>>
>> I use it to avoid processing lines that contain funny chars...
>>
>> if ($string =~ /[^[:print:]]/) {next OUTER;}
>>
>> :)
>>
> Python 3 (Unicode) strings have an .isprintable method:
>
> mystring.isprintable()
>

my strings are UTF-8. Will it work there too?




More information about the Python-list mailing list