tornado中自带的工具可以实现
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