“.”之间的区别和“./”和“./.”对于路径

Difference between "." and "./" and "./." for path

我尝试了 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)

谢谢

. 是您当前的文件夹。后面的/只指定它是一个文件夹,后面可以指定其他的folders/files(eg.myfolder/myfile) 所以 ./.current directory/current directory

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

./yourfile 执行您的文件(如果这是您的要求)

., ./ and ./.都是指当前目录。你用./file.ext来运行一个可执行文件。