2016-09-10 37 views
-2

我正在尋找一種方法來使鏈接可點擊。我正在使用python 2.7.9並編寫了一個程序來幫助我的學生。他們寫作的每個指標都附有鏈接以提供進一步幫助。現在,他們只是打印,學生需要複製和粘貼文件。我如何讓它們可點擊。在另一個窗口打開將是理想的,但我真的只想打開鏈接。python中的可單擊的html鏈接

爲例:

tx="# of pronouns" 
     t1=iTest["pro"] 
     t2=round(100*t1/number_of_words,1) 
     tc='''  
        You are not to use inclusive pronouns 
        in academic writing. 
        Please go to http://owll.massey.ac.nz/academic-writing/1st-vs-3rd-person.php to review.''' 
     row="<tr><td ><pro>"+tx+"</pro></td> <td>"+str(t1)+"</td> <td>"+str(t2)+"%</td> <td>"+tc+"</td>" 
     if t1>0: fo.writelines(row) #only print this row if there are personal pronouns 
+0

中查找HTML地址標籤 Please click here.(更改httpz爲HTTP。我這樣做只是爲了評論,所以它不會顯示爲StackOverflow上的鏈接。) –

+0

丹尼爾試圖說的是你不能只把'鏈接'作爲一段文本,它需要放在HTML地址標記中。 HTML是一種標記語言,可以將文本轉換爲計算機可以理解的格式,然後以人類可以識別它的方式在屏幕上「繪製」文本。因此,在這種情況下,標籤會將您的'http ....'文本更改爲實際可點擊的鏈接,因此瀏覽器會將其「呈現」爲鏈接,而人類將看到鏈接,並且不會顯示原始文本和去'噢好吧,我可以點擊這個'。 :) – rmcsharry

+0

謝謝大家的幫助!它奇妙地工作! –

回答

0

你想達到這樣的事:

<a href="http://owll.massey.ac.nz/academic-writing/1st-vs-3rd-person.php"> 
 
    http://owll.massey.ac.nz/academic-writing/1st-vs-3rd-person.php 
 
</a>