htmldata and python 2.2

From: Tim Arnold (tiarno_at_sas.com)
Date: 10/21/04


Date: Thu, 21 Oct 2004 11:48:42 -0400

I'm trying to get htmldata.py (written with Python 2.3 in mind) to work with
Python 2.2. Thanks much to Paul Clinch for showing me how to convert
for i, text in enumerate(L)
to
for i, text in zip(range(len(L)),L)

I have one more glitch in getting htmldata.py to work in Python2.2:
Can someone show me how to recode this without the finditer?

L = list(re.finditer(r'url\s*\(([^\r\n\("]*?)\)|' +
                         r'url\s*\(\s*"([^\r\n]*?)"\s*\)', doc))

 The doc says re.finditer is available in 2.2, but I'm guessing it must be
in a minor version update (e.g., 2.2.3). Anyway, I'm getting this error in
the Traceback:

 L = list(re.finditer(r'url\s*\(([^\r\n\("]*?)\)|' +
AttributeError: 'module' object has no attribute 'finditer'

thanks,
--Tim Arnold

p.s. htmldata.py is public domain code to manipulate
HTML or XHTML documents from Connelly Barnes.
(http://oregonstate.edu/~barnesc/htmldata/)



Relevant Pages

  • Re: htmldata and python 2.2
    ... > Python 2.2. ... Thanks much to Paul Clinch for showing me how to convert ... a bug that was fixed ...
    (comp.lang.python)
  • Re: reusing parts of a string in RE matches?
    ... finditer is also a good tool to use ... in Germany w/three large bookstores in the center, ... Not that I wouldn't order books (I do that all the ... sad-faced to see the small impact of the Python ...
    (comp.lang.python)
  • print function in python3.1
    ... Python 3.1.1 ... Why is it showing %s in the output? ... I dont want to sql % because that doesnt escape the strings ...
    (comp.lang.python)
  • Re: Combining several files
    ... combined files into another director. ... I'm new to Python and just can't get it to work. ... Try adding a few print statements, showing the files and directories it is processing. ...
    (comp.lang.python)
  • Re: Syntax across languages
    ... > Thank you Fredrik Lundh for showing everybody that indeed lot of people ... > feel the need of such function in Python too. ... Prev by Date: ...
    (comp.lang.python)