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

前端 未结 4 763
孤独总比滥情好
孤独总比滥情好 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:27

    Try to use URI with file: scheme like file:///C:/TestData/openfolder.html in your html:

    Link to test data
    

    Here is article on using file URIs in Windows.

    UPD (extraction from comments): Each browser has its own way to handle such urls. At least Internet Explorer 8 under Windows 7 opens links in Windows Explorer as was required by jags.

    Finally, for dynamic pages the web server is required. If one is needed take a look at discussion on creating simple web services using python.

提交回复
热议问题