Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76389

string encoding regex problem

From Philipp Kraus <philipp.kraus@flashpixx.de>
Newsgroups comp.lang.python
Subject string encoding regex problem
Date 2014-08-16 02:27 +0200
Organization 1&1 Internet AG
Message-ID <lsm8ic$j90$1@online.de> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

I have defined a function with:

def URLReader(url) :
    try :
        f = urllib2.urlopen(url)
        data = f.read()
        f.close()
    except Exception, e :
        raise MyError.StopError(e)
    return data

which get the HTML source code from an URL. I use this to get a part of 
a HTML document without any HTML parsing, so I call (I would like to 
get the download link of the boost library):

found = re.search( "<a 
href=\"/projects/boost/files/latest/download\?source=files\" 
title=\"/boost/(.*)", 
Utilities.URLReader("http://sourceforge.net/projects/boost/files/boost/") 
)
if found == None :
	raise MyError.StopError("Boost Download URL not found")

But found is always None, so I cannot get the correct match. I didn't 
find the error in my code.

Thanks for help

Phil

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

string encoding regex problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-08-16 02:27 +0200
  Re: string encoding regex problem Roy Smith <roy@panix.com> - 2014-08-15 20:48 -0400
    Re: string encoding regex problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-08-16 04:08 +0200
      Re: string encoding regex problem Roy Smith <roy@panix.com> - 2014-08-15 22:14 -0400
      Re: string encoding regex problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-16 14:35 +1000
      Re: string encoding regex problem Peter Otten <__peter__@web.de> - 2014-08-16 11:01 +0200
        Re: string encoding regex problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-08-23 22:46 +0200
          Re: string encoding regex problem Peter Otten <__peter__@web.de> - 2014-08-23 23:13 +0200

csiph-web