![](/img/trans.png)
[英]Displaying image from directory to html page using Flask Python
[英]Displaying directory content in html page with python
我想用python編寫一個程序,該程序可以讀取目錄下的文件,並可以在python程序動態創建的html頁面中將它們顯示為超鏈接,任何人都可以建議我是python的新手。
轉到目錄,您要列出並運行:
使用Python 2.7:
$ python -m SimpleHTTPServer
使用Python 3.x:
$ python -m http.server
這將在端口8000上啟動本地簡單HTTP服務器。
訪問http://localhost:8000
,您將看到當前目錄的列表,甚至可以瀏覽。
警告:使用此解決方案可能會帶來安全風險,因為無論訪問已發布的url的人都可以訪問所有文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.