I am a newbie to python. I'm trying to crawl some text, but it doesn't work... Here is my code
def parse(self,response):
hxs = Selector(response)
article_list = hsx.xpath('//*[@id="weather"]')
print('##################### total_length : ' + str(len(article_list)))
for a in article_list:
html_response = HtmlResponse(uurl="", body=a.encode('utf-8') #??
seoul = html_response.xpath('//dl[@class="po_seoul"]//dd[@class="temp"]')[0].extract()
and this is the html code.
<h1 class="blind">weather_data</h1>
<div id="weather" class="weather" >
<dl class="po_seoul">
<dt>seoul</dt>
<dd class="weather"><a href="#" onclick="showLandForecast('1159068000'); return false;" data-stn="108"><img src="/images/icon/NW/NB04.png" alt="cloud" /></a></dd>
<dt class="blind">temperature</dt>
<dd class="temp">21.2</dd>
</dl>
Error message:
seoul = html_response.xpath('//dl[@class="po_seoul"]//dd[@class="temp"]')[0].extract()
^
SyntaxError: invalid syntax
plz help me...T0T
html_response = HtmlResponse(uurl="", body=a.encode('utf-8')you are missing closing parentheses in this line.