[Tutor] regular expressions question

nimrodx nimrodx at slingshot.co.nz
Sat Aug 12 14:03:54 CEST 2006

Hi All,

I am trying to fish through the history file for the Konquerer web 
browser, and pull out the
web sites visited.

The file's encoding is binary or something

Here is the first section of the file:

Does that tell you anything?

I have been trying to replace the pesky \x00's with something less 
annoying, but
with no success:
   import re
   pattern = r"\x00"
   re.sub(pattern, '', dat2)

That seems to work at the command line, but this this:

   web = re.compile(
   res = re.findall(web,dat2)
tends to give me back individual alphanumeric characters, "."'s, and "/"'s,
as if they had each been separated by an unmatched character:
e.g. ['z', 't', 'f', 'i', 'l', 'e', 'h', 'o', 'm', 'e', 'a', 'l', 'p', 
'h', 'a',...]

I was hoping for one web address per element of the list...

Suggestions greatly appreciated!!



More information about the Tutor mailing list