Home  >  Q&A  >  body text

python如何将爬取的网站url,变成超链接的形式

**这是我爬取的内容,写到了txt文本中,我想让它变成超链接的形式。
没有url,直接文字就可以进去到相关的页面。**我该怎么做呢?

求大神指点,先行谢过。

黄舟黄舟2741 days ago860

reply all(2)I'll reply

  • 阿神

    阿神2017-04-18 10:27:28

    To use hyperlinks, you must have documents in a format that supports hyperlinks.

    txt不支持超链接,你可以用html

    Save these two contents of yours as:

    <html>
        <head>
            <meta charset='utf-8'>
        </head>
        
        <body>
            <a href="[url]">[name]</a>
        </body>
    <html>
    

    Which [url]用你爬到的连接替换,[name]用你爬到的标题替换,增加<a> tag would be nice.

    If you don’t understand<a>what a tag is, just look at this: http://www.runoob.com/tags/ta...

    reply
    0
  • PHPz

    PHPz2017-04-18 10:27:28

    It is recommended that you learn the basics of html

    reply
    0
  • Cancelreply