Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
Use expresiones regulares para extraer información de una URL

¿Cómo obtener la identificación de la página por URL en Flask?

 http://localhost/page34 http://localhost/page35

Quiero que la palabra "página" se fije con una letra o un número al lado que represente la página, ¿cómo hago esto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Adaptado de esta respuesta . También puede utilizar este ejemplo de la documentación de Werkzeug .

 from flask import Flask from werkzeug.routing import BaseConverter class RegexConverter(BaseConverter): def __init__(self, url_map, *items): super().__init__(url_map) self.regex = items[0] app = Flask(__name__) app.url_map.converters['regex'] = RegexConverter @app.route('/page<regex("\d+"):page_id>/') def page(page_id): return f"Page ID: {page_id}" if __name__ == '__main__': app.run()

ingrese la descripción de la imagen aquí

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!