473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

htmldata and python 2.2

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/)
Jul 18 '05 #1
1 1361
In article <cl**********@license1.unx.sas.com>,
"Tim Arnold" <ti****@sas.com> wrote:
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'


Seems you're hitting http://python.org/sf/585882, a bug that was fixed
in 2.2.2. You could use re.findall() instead.

Just
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Emile van Sebille | last post by:
QOTW: "If we get 2.3.3c1 out in early December, we could release 2.3.3 final before the end of the year, and start 2004 with a 100% bug-free codebase <wink>." -- Tim Peters "cjOr proWe vbCould...
0
by: Emile van Sebille | last post by:
QOTW: "Have you ever used the copy module? I am *not* a beginner, and have used it *once* (and I can't remember what for, either)." -- Michael Hudson "It will likely take a little practice...
0
by: Emile van Sebille | last post by:
QOTW (in the OS agnostic category): "There is a (very popular) Python package out there which exposes the win32 api. I'm not sure what it's called. (win32api? pythonwin? win32all?)" -- Francis...
0
by: C. Barnes | last post by:
htmldata 1.0.4 is available. http://oregonstate.edu/~barnesc/htmldata/ The htmldata module allows one to translate HTML documents back and forth to list data structures. This allows for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.