Python url converted to a tag

The tools that come with tornado can achieve this

from tornado.escape import linkify
linkify('https://www.google.com/')
Out[8]: '<a href="https://www.google.com/">https://www.google.com/</a>'
linkify('https://www.google.com/',extra_params='target="_blank"')
Out[9]: '<a href="https://www.google.com/" target="_blank">https://www.google.com/</a>'
tornado.escape — Escaping and string manipulation — Tornado 6.1 documentation

Guess you like

Origin blog.csdn.net/u011519550/article/details/125049077