Thank you all guys. It seems like the simpler the solution, the more I
am happy about it. Sorry, for the simple question, I am quite new to
this lang.
Cheers.
Robert Kern wrote:
> Yoav wrote:
>
>>Don't think it will do much good. I need to get them from a file and
>>extract the last folder i
In article <[EMAIL PROTECTED]>, Yoav <[EMAIL PROTECTED]> wrote:
>Fredrik Lundh wrote:
>> "Yoav" wrote:
>>>I am trying the following:
>>>
>>>re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files")
>> instead of struggling with weird REs, why not use Python's standard
>> filename manipulation library inste
Yoav wrote:
> Don't think it will do much good. I need to get them from a file and
> extract the last folder in the path. For example:
> if I get "c:\dos\util"
> I want to extract the string "\util"
You mean like this:
import os
os.path.sep + os.path.split(r"c:\dos\util")[-1]
--
Robert Kern
[
Hi,
> Don't think it will do much good. I need to get them from a file and
> extract the last folder in the path. For example:
> if I get "c:\dos\util"
> I want to extract the string "\util"
Still, os.path is your friend:
import os
filepath = r'C:\dos\util'
base, last = os.path.split(file
Yoav wrote:
> Don't think it will do much good. I need to get them from a file and
> extract the last folder in the path. For example:
> if I get "c:\dos\util"
> I want to extract the string "\util"
Then os.path.basename should be for you.
Reinhold
--
http://mail.python.org/mailman/listinfo/py
Yoav wrote:
> Don't think it will do much good. I need to get them from a file and
> extract the last folder in the path. For example:
> if I get "c:\dos\util"
> I want to extract the string "\util"
like frederik says (I use '/' as I am using Unix):
>>> import os
>>> os.path.split ('c:/foo/ba
Don't think it will do much good. I need to get them from a file and
extract the last folder in the path. For example:
if I get "c:\dos\util"
I want to extract the string "\util"
Fredrik Lundh wrote:
> "Yoav" wrote:
>
>>I am trying the following:
>>
>>re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_
Thanks guys. Issue solved.
I am also going to give Microsoft a call about it. Any other issues you
want me to raise while I am talking to them?
Cheers.
Robert Kern wrote:
> Yoav wrote:
>
>>I am trying the following:
>>
>>re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files")
>>
>>and I get a return
"Yoav" wrote:
>I am trying the following:
>
> re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files")
>
> and I get a return of NoneType, and I have no idea why. I know that I
> missing something here, but I really can't figure out why
instead of struggling with weird REs, why not use Python's standard
f
Yoav enlightened us with:
> I am trying the following:
>
> re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files")
>
> and I get a return of NoneType, and I have no idea why.
Because you don't match a carriage return "\r".
> I know that I missing something here, but I really can't figure out
> why (I be
Yoav wrote:
> I am trying the following:
>
> re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files")
>
> and I get a return of NoneType, and I have no idea why. I know that I
> missing something here, but I really can't figure out why (I bet it's
> something obvious). I also tried this RE on KODOS and
11 matches
Mail list logo