简体   繁体   中英

how to find out exact path of file using python?

how to find exact path of file in python.? This is very basic. But i am new to python

if my filename is file.txt

 path = "D:\\Utilities\\folder\\python\\model\\file.txt

how to get the exact path by giving only the filename?

Look into the os.path module , specifically abspath(path) , which:

return[s] a normalized absolutized version of the pathname path .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM