[Linux-programlama] Re: Python ile html parsing

---------

[Linux-programlama] Re: Python ile html parsing

From: Caglar Akyuz <caglar_at_bilkon-kontrol.com.tr>
Date: Sat, 17 Nov 2007 17:14:22 +0200
Message-ID: <473F054E.7080602@bilkon-kontrol.com.tr>

mirat can bayrak wrote:
> bir html dosyası içerisinde bütün <href="?"> etiketindeki ? kısmını okuyup
> listelemek istiyorum nasıl yaparım?

regular expression ile. Ben aşağıdakine benzer bir kod kullanıyorum.
Deneme şansım yok, o yüzden yazım hatası olabilir:

import re
html = open('/dosya/yolu','r')
regex = re.compile(r'<href=*>')

for line in html.readlines():
        line
        href = re.findall(regex,line)
        if href: #birşeyler buldu
                for s in href:
                        print s

html.close()

_______________________________________________
Linux-programlama mailing list
Linux-programlama_at_liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama
Received on Sat 17 Nov 2007 - 16:41:24 EET

---------

Bu arsiv hypermail 2.2.0 tarafindan uretilmistir.