Python implementation to obtain the absolute path of the file

Codes are as follows:

# Get the absolute path of the file 
Import OS
 class getPath:
     DEF get_path (Self, path): 
        R & lt = os.path.abspath with (path)
         return R & lt
 IF  the __name__ == ' __main__ ' : 
    A . GetPath = () get_path ( ' ./ get_getpath.py ' )
     Print (A)

 

Guess you like

Origin www.cnblogs.com/badbadboyyx/p/11938406.html