On Thu, Mar 19, 2009 at 5:28 PM, Darren Hart <dar...@dvhart.com> wrote:
> RIght & < and > - but my question was if there is some python call to
> do this or if I just have to roll my own.  I recently added this to my
> code base:

>>> from gobject import markup_escape_text
>>> markup_escape_text('A & B <C>')
'A &amp; B &lt;C&gt;'

For completeness, this is reversible via pango's parse_markup

>>> from pango import parse_markup
>>> parse_markup(markup_escape_text('A & B <C>'))[1] # Since parse_markup 
>>> returns a (pango.AttrList, text, accel_char) tuple (see docs)
'A & B <C>'


-- 
Neil Muller
drnlmul...@gmail.com

I've got a gmail account. Why haven't I become cool?
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to