我在視頻中看到有人這樣做,假設我有一個名為 code.txt 的 python 代碼,我在 powershell 中使用此命令執行它
python .\code.txt
.\這里有什么用,它也恰好可以使用./
uj5u.com熱心網友回復:
它只是一個參考當前目錄的符號。
python .\code.txt,python ./code.txt并python code.txt產生相同的結果,因為您的檔案需要在當前的 cmd/shell 目錄中才能以這種方式運行。否則,您可以在指定完整路徑的當前 cmd/shell 目錄之外執行它,如python C:\Users\Desktop\code.txt.
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/366183.html
