1
I am new to Django and am taking some information from a web page using lxml. I would like to know how to display the values on my website.
import requests
from lxml import html
from django.shortcuts import render
def list_data(request):  
    return render(request, 'data.html', {})
def get_idhm(url):
    page = requests.get(url)
    tree = html.fromstring(page.content)
    idhm = tree.xpath('//*[@id="responseMunicipios"]/ul/li[6]/div/p[2]/text()')
    return idhm[0]
def get_population(url):
    page = requests.get(url)
    tree = html.fromstring(page.content)
    values = tree.xpath('//*[@id="responseMunicipios"]/ul/li[3]/div/p[2]/text()')
    return values[0]
that’s the view.