A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-February/086474.html below:

[Python-Dev] File Path retrieving problem

[Python-Dev] File Path retrieving problem [Python-Dev] File Path retrieving problemSudhir Kakumanu music24by7 at gmail.com
Wed Feb 25 16:12:43 CET 2009
Hi all,
I am new to Python, i have installed python 2.5.4 and it is my requirement.

I need to retrieve the path of filename in python.

I have found some API's to get this:

from os.path import realpath
print realpath("NEWS.txt")  # here NEWS.txt exists and it shows the path of
the file as C:\Python25\WorkSpace\NEWS.txt
print realpath("abc.txt") # here abc.txt does not exist but still it
shows C:\Python25\WorkSpace\abc.txt

can anybody tell the reason why????


Now took some safety measures:

found = lexists(realpath(filename))
        if found == 0:
            print "Not Found"
        else:
            print realpath(filename)

i have given the filename as "NEWS.txt" and "abc.txt" but i am always
getting the output as "Not Found"


Can anyone please tell me where am i doing wrong????

also any suggestions to retrieve the filepath from a given filename is
highly appreciated.

Thanks in advance.


Regards,
Sudhir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090225/9a104741/attachment.htm>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4