两者之间的区别。以及“ ./”和“ ./。”路径

时间:2019-08-06 18:56:49

标签: python linux terminal git-bash

我尝试了ls'。',ls'./'和ls'./。' ,它们都给我相同的结果。

但是对于某个文件,我只能使用“ python file ./”运行它,而不能使用其他两个选项运行它。所以我想知道它们之间有什么区别。

编辑:

我没有写这个。

try:
    in_dir = sys.argv[1]
except:
    sys.exit("Usage: python formatter_oocl.py path/to/dir")

in_dir = "OOCL_RAW_DATA/" # name of directory where xls files will be read from
files = os.listdir("./"+in_dir)
#files = ['./' + in_dir + files[i] for i in range(len(files))]
print(files)

谢谢

2 个答案:

答案 0 :(得分:2)

.是您的当前文件夹。之后的/仅指定它是一个文件夹,并允许您随后指定其他文件夹/文件(例如myfolder/myfile 所以 ./.current directory/current directory

据我所知,没有区别...

./yourfile执行您的文件(如果您要这样做的话)

答案 1 :(得分:1)

., ./ and ./.都引用当前目录。您使用./file.ext运行可执行文件。

相关问题