Python : lxml xpath get two different classes
问题 Here is my sample Python code import requests import lxml.html page = '<div class="aaaa12"><span class="test">22</span><span class="number">33</span></div><div class="dddd13"><span>Kevin</span></div>' tree = lxml.html.fromstring(page) number = tree.xpath('//span[@class="number"]/text()') price = tree.xpath('.//div[@class="dddd13"]/span/text()') print number print price When I ran I could get like below ['33'] ['Kevin'] However, I would like to get both at once like = ['33','Kevin'] I tried