Python实现获取文件的绝对路径

实现代码如下:

#获取文件的绝对路径
import os
class getpath:
    def get_path(self,path):
        r=os.path.abspath(path)
        return r
if __name__ == '__main__':
    a=getpath().get_path('./get_getpath.py')
    print(a)

猜你喜欢

转载自www.cnblogs.com/badbadboyyx/p/11938406.html