Answer the question
In order to leave comments, you need to log in
How to limit a Python xpath list?
from lxml import html
import requests
page = requests.get('https://coinmarketcap.com/all/views/all/')
tree = html.fromstring(page.content)
names = tree.xpath('//*[@class="currency-name-container"]/text()')
Answer the question
In order to leave comments, you need to log in
Doesn't this build work?
names = tree.xpath('//*[@class="currency-name-container"]/text()')[0:150]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question