Python's pathlib Module

preview_player
Показать описание
Python's standard library pathlib module can be used to manipulate paths, and work with the file system independently of the specific operating system the Python app is running on, making one of the best choices for working with files and paths. In addition, it also supports a concept called globbing that can be used to recursively find files matching a specified pattern in the file system.

#mathbyteacademy #python

Code for this Video
================

My Python Courses
=================

- Python 3 Fundamentals (introduction to Python)

- Python 3 Deep Dive (Part 1 - Functional)

- Python 3 Deep Dive (Part 2 - Iteration, Generators)

- Python 3 Deep Dive (Part 3 - Hash Maps)

- Python 3 Deep Dive (Part 4 - OOP)
Рекомендации по теме
Комментарии
Автор

Dude you don't know how long I've looked for a good video on this module. Thank you so so much and may you keep up the good work

josephomondi
Автор

Thanks, Fred, for bringing it in. Despite heavy using Path for files for a long time, I personally severely underestimated how convenient Path actually is for URLs. Way better instead of:

good_url = '/' + some_url.strip('/') + '/myendpoint'

to say:

good_url = Path('/') / Path(some_url).name / 'myendpoint'

Not much of being shorter but way more visually pleasant.

AlexanderDemin
Автор

Thanks, Fred! Clear and detailed explainations!

chrisyoung
Автор

Thank you so much Fred!!! I have learned so much useful/in-depth things from your videos.

reneeliu
Автор

Thanks Fred, another great and comprehensive video. I really enjoy your in-depth discussions of individual modules, either from the standard library or third-party libraries! Would love a similar video about the `re` module with some regex magic :)

Worthy additions are two of my favorite `pathlib` methods: `.read_text()` and `.write_text()`. When starting out with Python it was really puzzling to me why I had to write two lines and a context manager to read a simple text file.
With `pathlib` it is as simple as `p.read_text(file)` instead of the usual `with p.open() as f: f.read()` <3

joelbeck
Автор

Thanks Fred,
I would like to see something about os library, and how os.path differs from this and the pros and cons of each

SuperHamadahmed
Автор

Fred, thanks for the videos. As a person from math background i enjoy learning from your videos. I would like to ask you if you could create an introductory video about the whole set of software engineering. Let Swe= { {fron end}, {back end}, {data bases} and etc …}.
I am transitioning from math, but i cant find a video explaining about the whole industry. It would be nice if we had that video which tells us what knowledge is necessary for each subset and amount of knowledge necessary for different experience levels in that subset.
As of know i dont even know what path to choose, what material to learn, how far to study before applying for a job. If you were starting today (0 cs knowledge, heavy in math) what path would you choose in swe, and what material necessary to learn for that path? It would help a lot.

yusupgeldiyev