"Thomas Jollans" <[EMAIL PROTECTED]> writes:
> "Adam Atlas" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > As far as I know, there isn't a standard idiom to do this, but it's
> > still a one-liner. Untested, but I think this should work:
> >
> > import re
> > from htmlentitydef
In article <[EMAIL PROTECTED]>,
Matimus <[EMAIL PROTECTED]> wrote:
>On Jun 4, 6:31 am, "js " <[EMAIL PROTECTED]> wrote:
>> Hi list.
>>
>> If I'm not mistaken, in python, there's no standard library to convert
>> html entities, like & or > into their applicable characters.
>>
>> htmlentitydefs prov
Thanks you Matimus.
That's exactly what I'm looking for!
Easy, clean and customizable.
I love python :)
On 6/5/07, Matimus <[EMAIL PROTECTED]> wrote:
> On Jun 4, 6:31 am, "js " <[EMAIL PROTECTED]> wrote:
> > Hi list.
> >
> > If I'm not mistaken, in python, there's no standard library to convert
>
On Jun 4, 6:31 am, "js " <[EMAIL PROTECTED]> wrote:
> Hi list.
>
> If I'm not mistaken, in python, there's no standard library to convert
> html entities, like & or > into their applicable characters.
>
> htmlentitydefs provides maps that helps this conversion,
> but it's not a function so you have
In article <[EMAIL PROTECTED]>,
Adam Atlas <[EMAIL PROTECTED]> wrote:
>As far as I know, there isn't a standard idiom to do this, but it's
>still a one-liner. Untested, but I think this should work:
>
>import re
>from htmlentitydefs import name2codepoint
>def htmlentitydecode(s):
>return re.su
"Adam Atlas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> As far as I know, there isn't a standard idiom to do this, but it's
> still a one-liner. Untested, but I think this should work:
>
> import re
> from htmlentitydefs import name2codepoint
> def htmlentitydecode(s):
>retu
In article <[EMAIL PROTECTED]>,
Adam Atlas <[EMAIL PROTECTED]> wrote:
>As far as I know, there isn't a standard idiom to do this, but it's
>still a one-liner. Untested, but I think this should work:
>
>import re
>from htmlentitydefs import name2codepoint
>def htmlentitydecode(s):
>return re.su
As far as I know, there isn't a standard idiom to do this, but it's
still a one-liner. Untested, but I think this should work:
import re
from htmlentitydefs import name2codepoint
def htmlentitydecode(s):
return re.sub('&(%s);' % '|'.join(name2codepoint), lambda m:
name2codepoint[m.group(1)], s