链接纯文本
autolink的Python项目详细描述
将类似url和电子邮件的字符串转换为链接。
安装
pip install autolink
用法
fromautolinkimportlinkifylinkify('some text google.com, ...')# -> 'some text <a href="http://google.com">google.com</a>, ...'linkify('https://github.com',{'rel':'nofollow'})# -> '<a href="https://github.com" rel="nofollow">https://github.com</a>'linkify('me@ya.ru')# -> '<a href="mailto:me@ya.ru">me@ya.ru</a>'