[PyQt] RegExp and QString

Ozan Çağlayan ozan at pardus.org.tr
Fri Feb 8 22:19:17 GMT 2008


Tiago Maluta wrote On 11-02-2008 08:22:
> Hi,
> 
> Following Assistant (for C++) documentation about QString split method I 
> saw:
> 
> str = "Now: this sentence fragment.";
> list = str.split(QRegExp("\\b"));
> // list: [ "", "Now", ": ", "this", " ", "sentence", " ", "fragment", "." ]
> 
> Now, I with python I tried, a simple example:
> 
> 
>  line = p.readline()
>  sline = line.split(QtCore.QRegExp("[A-Z]+"))

Hi,

You're trying to use the split() method of the python core string type 
and this method needs a character buffer which contains the delimiter 
characters.

But the example that you've found out in the documentation uses the 
split() method of the QString class.

-- 
Ozan ÇAĞLAYAN
http://cekirdek.pardus.org.tr/~ozan
<ozan_at_pardus.org.tr>


More information about the PyQt mailing list