I am scraping some data from a website via python.
I want to do two things
I want to skip the first 2 words "Dubai" and "UAE" which are common in every webscraping result.
I want to save the last two words in two different variables with strip without the extra spaces.
try: area= soup.find('div', 'location') area_result= str(area.get_text().strip().encode("utf-8")) print "Area: ",area_result except StandardError as e: area_result="Error was {0}".format(e) print area_result
area_result: consists of the following data:
'UAE \xe2\x80\xaa>\xe2\x80\xaa\n \n Dubai \xe2\x80\xaa>\xe2\x80\xaa\n \n Business Bay \xe2\x80\xaa>\xe2\x80\xaa\n \n Executive Towers \n \n\n\n \n\n\n\t \n\t \n\t \n\t\n\n\n \n ;\n \n \n \n 1.4 km from Burj Khalifa Tower'
I want the above result to be displayed as (Note the >
between Executive Towers
and 1.4 km..
Executive Towers > 1.4 km from Burj Khalifa Tower