>> I would not write it this way, but as
>>
>> for name,codepoint in htmlentitydefs.name2codepoint:
>> entity_map[name] = unichr(codepoint)
>
> has dictionary iteration changed in 3.0? if not, your code doesn't
> quite work.
Right - I forgot to add .items().
> and even if you fix that, it doe
Martin v. Löwis wrote:
>> entity_map = htmlentitydefs.entitydefs.copy()
>> for name, entity in entity_map.items():
>> if len(entity) != 1:
>> entity_map[name] = unichr(int(entity[2:-1]))
>>
>> (entitydefs is pretty unusable as it is, but it was added to Python
>> before
> entity_map = htmlentitydefs.entitydefs.copy()
> for name, entity in entity_map.items():
> if len(entity) != 1:
> entity_map[name] = unichr(int(entity[2:-1]))
>
> (entitydefs is pretty unusable as it is, but it was added to Python
> before Python got Unicode strings, a
Martin v. Löwis wrote:
>> In trying to parse html files using ElementTree running under Python
>> 3.0a1, and using htmlentitydefs.py to add "character entities" to the
>> parser, I found that I needed to create a customized version of
>> htmlentitydefs.py to make things work properly.
>
> Can you
On Dec 26, 8:53 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > Without an additional parser, I was getting the following error
> > message:
> [...]
> > xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11
>
> To understand that problem better, it would have been helpful to se
> Without an additional parser, I was getting the following error
> message:
[...]
> xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11
To understand that problem better, it would have been helpful to see
what line 401, column 11 of the input file actually says. AFAICT,
it must
On Dec 26, 7:30 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> André wrote:
> > In trying to parse html files using ElementTree running under Python
> > 3.0a1, and using htmlentitydefs.py to add "character entities" to the
> > parser, I found that I needed to create a customized version of
> >
André wrote:
> In trying to parse html files using ElementTree running under Python
> 3.0a1, and using htmlentitydefs.py to add "character entities" to the
> parser, I found that I needed to create a customized version of
> htmlentitydefs.py to make things work properly.
Can you please state what
In trying to parse html files using ElementTree running under Python
3.0a1, and using htmlentitydefs.py to add "character entities" to the
parser, I found that I needed to create a customized version of
htmlentitydefs.py to make things work properly.
The change needed was to replace (at the bottom