How to Get File Name from a Path in Python
Four ways to pull the file name out of a path in Python, when to use pathlib instead of os.path, and how…
Try: python lists, javascript functions, syntax error, first project
Plain-English Python guides, from installing it to writing small programs that do real work. Short examples you can copy, run and change.
72 guides
Four ways to pull the file name out of a path in Python, when to use pathlib instead of os.path, and how…
np.stack() joins arrays along a brand-new axis. Here is what that means, how it differs from concatenate, vstack and hstack, and when…
Take a Python script from a single messy file to a real project: folders, a virtual environment, a requirements file, tests and…
Python is installed but Windows cannot find it. The cause is a missing PATH entry or the Microsoft Store alias. Three fixes,…
Assigning to a slice, filling a range of positions, replacing a section with a different number of items, and the shape errors…
uv replaces pip, venv, pyenv and Poetry with one fast tool. What it does differently, a side-by-side of everyday commands, and who…
Printing a list plainly, one item per line, numbered, joined into a sentence, or as a formatted table — with the join()…
What Python warnings mean, how to see them all, silence the ones you have decided about, and turn the dangerous ones into…
The array errors beginners hit most — IndexError, modifying while looping, the copy trap — plus the changes that actually make list…
Reading and writing files, handling paths that work on every machine, and the encoding trap that only appears on someone else’s computer.
A virtual environment is a private folder of packages for one project. Why you need one, how to create and activate it…
How to open, read, write and append files in Python using with, plus the path and encoding traps that make files behave…
Related topics
The fastest way to improve is to read one guide, then build the thing it describes. Start with the basics, or jump straight to a project.