Re: Extracting subsequences composed of the same character

2011-04-01 Thread candide
Thanks, yours responses gave me the opportunity to understand the "backreference" feature, it was not clear in spite of my intensive study of the well known RE howto manual. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting subsequences composed of the same character

2011-03-31 Thread Terry Reedy
On 3/31/2011 10:20 PM, Tim Chase wrote: On 03/31/2011 07:43 PM, candide wrote: "pyyythhooonnn ---> " and you search for the subquences composed of the same character, here you get : 'yyy', 'hh', 'ooo', 'nnn', '---', '' Or, if you want to do it with itertools instead of the "re" modul

Re: Extracting subsequences composed of the same character

2011-03-31 Thread Tim Chase
On 03/31/2011 07:43 PM, candide wrote: "pyyythhooonnn ---> " and you search for the subquences composed of the same character, here you get : 'yyy', 'hh', 'ooo', 'nnn', '---', '' Or, if you want to do it with itertools instead of the "re" module: >>> s = "pyyythhooonnn ---> " >>

Re: Extracting subsequences composed of the same character

2011-03-31 Thread Tim Chase
On 03/31/2011 07:43 PM, candide wrote: Suppose you have a string, for instance "pyyythhooonnn ---> " and you search for the subquences composed of the same character, here you get : 'yyy', 'hh', 'ooo', 'nnn', '---', '' >>> import re >>> s = "pyyythhooonnn ---> " >>> [m.group(0)

Re: Extracting subsequences composed of the same character

2011-03-31 Thread Roy Smith
In article <4d952008$0$3943$426a7...@news.free.fr>, candide wrote: > Suppose you have a string, for instance > > "pyyythhooonnn ---> " > > and you search for the subquences composed of the same character, here > you get : > > 'yyy', 'hh', 'ooo', 'nnn', '---', '' I got the following.

Re: Extracting subsequences composed of the same character

2011-03-31 Thread MRAB
On 01/04/2011 01:43, candide wrote: Suppose you have a string, for instance "pyyythhooonnn ---> " and you search for the subquences composed of the same character, here you get : 'yyy', 'hh', 'ooo', 'nnn', '---', '' It's not difficult to write a Python code that solves the problem, fo

Extracting subsequences composed of the same character

2011-03-31 Thread candide
Suppose you have a string, for instance "pyyythhooonnn ---> " and you search for the subquences composed of the same character, here you get : 'yyy', 'hh', 'ooo', 'nnn', '---', '' It's not difficult to write a Python code that solves the problem, for instance : def f(text): ch