Extracting path of a program from a list.

aditya shukla adityashukla1983 at gmail.com
Wed Aug 27 00:15:58 EDT 2008


Hello folks,

I wanna know how can i extract path of a program whose path i have added to
the PATH variable.

This is what i have done

import os

x=os.getenv("PATH")

print x

>>%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program
Files\Microsoft SQL Server\90\Tools\binn\;C:\Program
Files\QuickTime\QTSystem\;C:\folder1\folder2\prog

Now i have to extract the path of my program ie (C:\folder1\folder2\prog) .I
mean i can split the string using

y=x.split(';')

a=y[-1]

but i dont wanna do this way ,i  wanna search for my program from this list
and then return its path

Please help me on this.

Thanks in advance.


Aditya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080826/806e2da7/attachment.html>


More information about the Python-list mailing list