Fillmore writes:
> On 3/11/2016 2:23 PM, MRAB wrote:
> > Python 3 (Unicode) strings have an .isprintable method:
> >
> > mystring.isprintable()
>
> my strings are UTF-8. Will it work there too?
You need to always be clear on the difference between text (the Python 3
‘str’ type) versus bytes.
It
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 h
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:
mystri
On Fri, Mar 11, 2016 at 9:34 AM, Wolfgang Maier
wrote:
> On 11.03.2016 15:23, Fillmore wrote:
>>
>> On 03/11/2016 07:13 AM, Wolfgang Maier wrote:
>>>
>>> One lesson for Perl regex users is that in Python many things can be
>>> solved without regexes.
>>> How about defining:
>>>
>>> printable = {ch
On 11.03.2016 15:23, Fillmore wrote:
On 03/11/2016 07:13 AM, Wolfgang Maier wrote:
One lesson for Perl regex users is that in Python many things can be
solved without regexes.
How about defining:
printable = {chr(n) for n in range(32, 127)}
then using:
if (set(my_string) - set(printable)):
Fillmore wrote:
> On 03/11/2016 07:13 AM, Wolfgang Maier wrote:
>> One lesson for Perl regex users is that in Python many things can be
>> solved without regexes. How about defining:
>>
>> printable = {chr(n) for n in range(32, 127)}
>>
>> then using:
>>
>> if (set(my_string) - set(printable)):
>>
On 03/11/2016 07:13 AM, Wolfgang Maier wrote:
One lesson for Perl regex users is that in Python many things can be solved
without regexes.
How about defining:
printable = {chr(n) for n in range(32, 127)}
then using:
if (set(my_string) - set(printable)):
break
seems computationally heav
Wolfgang Maier :
> On 11.03.2016 13:13, Wolfgang Maier wrote:
>> One lesson for Perl regex users is that in Python many things can be
>> solved without regexes. How about defining:
>>
>> printable = {chr(n) for n in range(32, 127)}
>>
>> then using:
>>
>> if (set(my_string) - set(printable)):
>>
On 11.03.2016 13:13, Wolfgang Maier wrote:
One lesson for Perl regex users is that in Python many things can be
solved without regexes. How about defining:
printable = {chr(n) for n in range(32, 127)}
then using:
if (set(my_string) - set(printable)):
break
Err, I meant:
if (set(my_str
One lesson for Perl regex users is that in Python many things can be
solved without regexes. How about defining:
printable = {chr(n) for n in range(32, 127)}
then using:
if (set(my_string) - set(printable)):
break
On 11.03.2016 01:07, Fillmore wrote:
Here's another handy Perl regex wh
On Mar 10, 2016 6:33 PM, "Mark Lawrence" wrote:
>
> On 11/03/2016 00:25, Ian Kelly wrote:
>>
>> On Mar 10, 2016 5:15 PM, "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 cont
On 11/03/2016 00:25, Ian Kelly wrote:
On Mar 10, 2016 5:15 PM, "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's re module
On Mar 10, 2016 5:15 PM, "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's re module doesn't support POSIX character c
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;}
:)
--
https://mail.python.org/mailman/listinfo/python-list
14 matches
Mail list logo