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