Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion How do you htmlentities in Python
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Cameron Laird  
View profile  
 More options Jun 5 2007, 1:41 am
Newsgroups: comp.lang.python
From: cla...@lairds.us (Cameron Laird)
Date: Mon, 4 Jun 2007 15:41:37 +0000
Local: Tues, Jun 5 2007 1:41 am
Subject: Re: How do you htmlentities in Python
In article <1180965792.757685.132...@q75g2000hsh.googlegroups.com>,
Adam Atlas  <a...@atlas.st> 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.sub('&(%s);' % '|'.join(name2codepoint), lambda m:
>name2codepoint[m.group(1)], s)

How strange that this doesn't appear in the Cookbook!  I'm
curious about how others think:  does such an item better
belong in the Cookbook, or the Wiki?

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google