How to open a windows folder when clicking on some link on a HTML page using Python

前端 未结 4 700
孤独总比滥情好
孤独总比滥情好 2021-01-06 05:38

I am writing following program :

***import os
filepath=r\'C:\\TestData\\openfolder.html\'
abc=open(filepath,\'w\')
abc.writelines(\'&         


        
4条回答
  •  囚心锁ツ
    2021-01-06 06:08

    Alain's answer works.

    <'a href="FOLDER_PATH" target="_explorer.exe">Link Text<'/a>

    I removed the tick marks at the beginning and end, and found that it works in

    • Internet Explorer - opens a Windows Explorer window

    • Firefox (Windows and Linux), but opens a new tab - same as target="_blank"

    • Chrome - opens a new tab like Firefox

    I also noticed that / and \ (forward and backward slashes) are equal in html links - they can even be mixed.

提交回复
热议问题