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


Groups > comp.lang.python > #76389

string encoding regex problem

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!takemy.news.telefonica.de!telefonica.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail
From Philipp Kraus <philipp.kraus@flashpixx.de>
Newsgroups comp.lang.python
Subject string encoding regex problem
Date Sat, 16 Aug 2014 02:27:57 +0200
Organization 1&1 Internet AG
Lines 89
Message-ID <lsm8ic$j90$1@online.de> (permalink)
NNTP-Posting-Host p5b0c49a3.dip0.t-ipconnect.de
Mime-Version 1.0
Content-Type multipart/alternative; boundary=--------------12420417401678244667
X-Trace online.de 1408148876 19744 91.12.73.163 (16 Aug 2014 00:27:56 GMT)
X-Complaints-To abuse@einsundeins.com
NNTP-Posting-Date Sat, 16 Aug 2014 00:27:56 +0000 (UTC)
User-Agent Unison/2.1.10
Xref csiph.com comp.lang.python:76389

Show key headers only | 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