0
我有一个元组被转换为一个字符串并以HTML格式输出。该字符串包含指向页面的链接(例如http://www.google.com),但该链接实际上并没有超链接到google.com,因为它只是将其视为文本。如何从字符串中的数据创建超链接?
任何人都可以帮助我解决这个问题?这是我的代码:
commentString = ''
callComments = (interface.list_comments(db,10))
for comment in callComments:
commentString += str(comment) + '<br> <br>'
content = {'comments': '<p>%s</p>' % commentString,
}
HTML端:
<div class = "comments">
<p>These are some comments:</p>
%comments
</div>
使用正则表达式替换来自动链接它。 – DhruvPathak 2013-04-29 08:04:51
我不知道你的意思 – user2288946 2013-04-29 08:40:00