On Sep 29, 2:32 pm, [EMAIL PROTECTED] wrote: > It think he's saying it should look like this: > > (line noise snipped)
Or you can let BeautifulSoup do the dirty job for you and forget all this ugliness: from BeautifulSoup import BeautifulSoup soup = BeautifulSoup(text) for a in soup.findAll('a'): for attr in 'href','name': val = a.get(attr) if val: a[attr] = val.replace(' ','_') print soup George -- http://mail.python.org/mailman/listinfo/python-list