Next / Previous / Contents / Shipman's homepage

7.22. unicodeString: Match a Python-style Unicode string

The variable pp.unicodeString is a parser that matches Python Unicode string literals: letter 'u', followed by a string in either single or double quote characters. This parser does not support triply-quoted strings.

>>> print pp.unicodeString.parseString("u'Tarquin'")
["u'Tarquin'"]
>>> print pp.unicodeString.parseString('u"Jethro"')
['u"Jethro"']
>>> print pp.unicodeString.parseString('u"""Two\nSheds\nJackson"""')
['u""']