[issue33102] get the nth folder of a given path

2018-07-25 Thread Tal Einat
Tal Einat added the comment: -1 on adding this to os.path given the existence in pathlib. -- nosy: +taleinat ___ Python tracker ___ ___

[issue33102] get the nth folder of a given path

2018-07-25 Thread Tal Einat
Tal Einat added the comment: I'm closing this as "wontfix". Amjad, if you'd like to discuss this further, please bring it up on python-ideas. Serhiy, as the expert for the os.path module, FYI. -- nosy: +serhiy.storchaka ___ Python tracker

[issue33102] get the nth folder of a given path

2018-07-25 Thread Tal Einat
Change by Tal Einat : -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-

[issue33102] get the nth folder of a given path

2018-03-21 Thread Eric V. Smith
Eric V. Smith added the comment: Yes, it's cross platform. For a plain string version, you can use a utility function: >>> for i in range(n+1): ... path = os.path.dirname(path) ... I'm not sure it's worth adding this to os.path. -- ___ Python tr

[issue33102] get the nth folder of a given path

2018-03-21 Thread AmjadHD
AmjadHD added the comment: Yes but i dont know if this is cross platform solution, i guess this function should be in the os.path module. -- ___ Python tracker ___ ___

[issue33102] get the nth folder of a given path

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: Path.parents will do what you want. I don't have a Windows box handy, but this is on MacOS: >>> from pathlib import Path >>> p = >>> Path("/Users/User/AppData/Local/Programs/Python/Python36/Lib/asyncio/__init__.py") >>> p.parents[1] PosixPath('/Users/User/AppD

[issue33102] get the nth folder of a given path

2018-03-19 Thread amjad ben hedhili
Change by amjad ben hedhili : -- title: get the nth folder -> get the nth folder of a given path ___ Python tracker ___ ___ Python-bu

[issue33102] get the nth folder

2018-03-19 Thread amjad ben hedhili
New submission from amjad ben hedhili : It will be handy if there was an os or os.path function that returns the path to the nth directory in a given path for example: given path = "C:\Users\User\AppData\Local\Programs\Python\Python36\Lib\asyncio\__init__.py" os.path.nthpath(path, 2) returns