Python noob burada. Python ile bir HTML dosyasında bir substring içeren satırları yazdırmaya çalışıyorum. Dize dosyasında olduğunu biliyorum, çünkü bulduğum html dosyasında aradığım dizeyi ctrl + f ettiğimde. Ancak kodumu çalıştırdığımda istenen sonucu yazdırmıyor. Birisi yanlış yaptığımı açıklayabilir mi? istekleri paket response.content olarakHTML dosyasında dize bulma?
import requests
import datetime
from BeautifulSoup import BeautifulSoup
now =datetime.datetime.now()
cmonth = now.month
cday = now.day
cyear = now.year
find = 'boxscores/201'
url = 'http://www.basketball-reference.com/boxscores/index.cgi?lid=header_dateoutput&month={0}&day=17&year={2}'.format(cmonth,cday,cyear)
response = requests.get(url)
html = response.content
print html
for line in html:
if find in line:
print line