pythonic parsing of URL

GreenH Green.Horn.000 at
Sat Jul 28 05:10:32 CEST 2007

I get some string as below from a library method (qt3 I use.

I need file path on my system, for the above example:
C:/Documents and Settings/Username/My Documents/45-61-Abc fold-

I am doing the below, it doesn't look pythonic,
can someone suggest any elegant solution, which is not too cryptic to
understand? yep, I do care about readability of the code to average
python user :)

 tmpTuple = urlparse.urlparse(fileURLname)

tmpString = tmpTuple[2].strip('/\\')

fileName = urllib.unquote(tmpString)

#For some reason the string contained in 'fileName' has some
unprintable trailing characters, Any ideas on that?
#thus I do below

fileName = fileName.split('.vru')[0] + '.vru'


More information about the Python-list mailing list