I'm sorry! I mean pattern is an argument of the function, in this case, how I process special charactors.
    patter = 'www.'                   # not this
    if re.compile(pattern).match(string) is not None:
        ......
 
but not:
 
    if re.compile(r'www.').match(string) is not None:          
or
    if re.compile('www\.').match(string) is not None: 
 
, how you process special characters, like dot.



Fredrik Lundh <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:

> I am new to python regular _expression, I would like to use it to get an
> attribute of an html element from an html file?

if you want to parse HTML, use an HTML parser. if you want to parse
sloppy HTML, use a tolerant HTML parser:

http://www.crummy.com/software/BeautifulSoup/



--
http://mail.python.org/mailman/listinfo/python-list

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to