【问题标题】:What is the use of the .\ while executing python code in powershell在powershell中执行python代码时.\有什么用
【发布时间】:2022-01-03 17:08:07
【问题描述】:

我在视频中看到有人这样做 假设我有一个名为 code.txt 的 python 代码,我在 powershell 中使用这个命令执行了它

python .\code.txt 

.\ 在这里有什么用 它也恰好适用于./

【问题讨论】:

  • 这是文件的路径。

标签: python powershell


【解决方案1】:

这只是一个表示当前目录的符号。

python .\code.txtpython ./code.txtpython code.txt 产生相同的结果,因为您的文件需要位于当前 cmd/shell 目录中才能以这种方式运行。或者你可以在当前 cmd/shell 目录之外执行它,指定完整路径,如python C:\Users\Desktop\code.txt

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-26
    • 2020-05-24
    • 2011-12-18
    • 1970-01-01
    • 1970-01-01
    • 2011-11-20
    相关资源
    最近更新 更多