1、__file__属性对应文件名。 2、os.path.realpath(__file__)这样就可以得到文件的绝对路径。 转载于:https://www.cnblogs.com/JiangLe/p/4923343.html