The Python Oracle

How can I extract the folder path from file path in Python?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping

--

Chapters
00:00 Question
01:01 Accepted answer (Score 208)
01:54 Answer 2 (Score 124)
02:59 Answer 3 (Score 73)
03:15 Answer 4 (Score 5)
03:30 Thank you

--

Full question
https://stackoverflow.com/questions/1705...

Answer 1 links:
[pathlib]: https://docs.python.org/3/library/pathli...
[available on PyPI]: https://pypi.python.org/pypi/pathlib/
[os.path]: http://docs.python.org/2/library/os.path...

Answer 2 links:
[os.path]: http://docs.python.org/2/library/os.path...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #file #path #directory #extract

#avk47