~/talk

"Hot: Pathlib, Not: String Paths"

Talkat PyOhio 2024 · 2024-07-27..07-28· [python]
links:none on file
slides:none on file

Live demo replaces os.path strings with pathlib Path objects showing concrete methods and results: creating paths (Path, PurePath, platform-specific Windows/Posix classes), joining with '/', Path objects are hashable so they work as set keys, mkdir(parents=True, exist_ok=True) creates deep trees, touch/write_text/read_text create and read files, glob/rglob and new walk return iterative results, resolve vs absolute with resolve(..., strict=True) raises if target missing, unlink/rmdir/replace delete, and a cleanup script runs and successfully removes the created tree.

AI-written summary · about

  1. 0:00Introduction
  2. 1:05String path problems
  3. 3:12PurePath vs Path objects
  4. 4:16Creating path objects
  5. 6:48Path properties and manipulation
  6. 9:19Modifying path names
  7. 10:23Relative paths and resolution
  8. 11:48Joining and directory ops
  9. 13:36Checking and creating dirs
  10. 15:42Listing, globbing, removing
  11. 16:05File existence and creation
  12. 17:08Reading and writing files
  13. 18:11File metadata access
  14. 18:53Renaming, replacing, deleting
  15. 19:58Advanced filesystem checks
  16. 20:59Recursive cleanup function
  17. 22:03Pathlib in Python stdlib
  18. 22:44Live demo script
  19. 28:16Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.