You could just .split it:

>>> Path('logs/date.log.txt').stem.split('.')[0]
'date'

os.path works just as well:

>>> os.path.basename('logs/date.log.txt').split('.')[0]
'date'

It passes all of the tests:

In [11]: all(Path(k).stem.split('.')[0] == v for k, v in {
   ....:     'a': 'a',
   ....:     'a.txt': 'a',
   ....:     'archive.tar.gz': 'archive',
   ....:     'directory/file': 'file',
   ....:     'd.x.y.z/f.a.b.c': 'f',
   ....:     'logs/date.log.txt': 'date'
   ....: }.items())
Out[11]: True
Answer from Blender on Stack Overflow
🌐
Matplotlib
matplotlib.org › stable › api › _as_gen › matplotlib.pyplot.stem.html
matplotlib.pyplot.stem — Matplotlib 3.11.2 documentation
A stem plot draws lines perpendicular to a baseline at each location locs from the baseline to heads, and places a marker there. For vertical stem plots (the default), the locs are x positions, and the heads are y values.
🌐
Python
docs.python.org › 3 › library › pathlib.html
pathlib — Object-oriented filesystem paths
>>> p = PurePath('/usr/bin/python3') >>> p.parts ('/', 'usr', 'bin', 'python3') >>> p = PureWindowsPath('c:/Program Files/PSF') >>> p.parts ('c:\\', 'Program Files', 'PSF') (note how the drive and local root are regrouped in a single part) The parent, name, stem, and suffix properties describe different parts of a path.
🌐
PyPI
pypi.org › project › stem
stem
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
GeeksforGeeks
geeksforgeeks.org › python › matplotlib-pyplot-stem-in-python
Matplotlib.pyplot.stem() in Python - GeeksforGeeks
July 12, 2025 - A Stem plot plots vertical lines at each x position covered under the graph from the baseline to y, and places a marker there.
🌐
PYTHON CHARTS
python-charts.com › home › ranking › stem plot (lollipop chart) in matplotlib
Stem plot (lollipop chart) in matplotlib | PYTHON CHARTS
August 20, 2022 - The matplotlib stem function allows creating stem plots, also known as lollipop charts, in Python.
🌐
Pythontic
pythontic.com › visualization › charts › stem plot
Stem plot using Python and Matplotlib | Pythontic.com
A stem plot separates the digits in data points to form two columns. Python Matplotlib draws a stem plot as a set of Y values plotted against common X-axis values.
🌐
Python Programming
pythonprogramming.net › stemming-nltk-tutorial
Python Programming Tutorials
The reason why we stem is to shorten the lookup, and normalize sentences.
Find elsewhere
🌐
Udemy
udemy.com › development
Python STEM Essentials
February 1, 2023 - This course is an introduction to useful python functionality in scientific research and engineering applications that is rarely taught rigorously in universities. It begins with an overview of required numerical libraries, such as NumPy and ...
Rating: 4.7 ​ - ​ 125 votes
🌐
GeeksforGeeks
geeksforgeeks.org › machine learning › python-stemming-words-with-nltk
Python | Stemming words with NLTK - GeeksforGeeks
July 11, 2025 - A stemming algorithm reduces the words “chocolates”, “chocolatey”, and “choco” to the root word, “chocolate” and “retrieval”, “retrieved”, “retrieves” reduce to the stem “retrieve”.
🌐
Matplotlib
matplotlib.org › stable › gallery › lines_bars_and_markers › stem_plot.html
Stem plot — Matplotlib 3.11.2 documentation
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) plt.stem(x, y) plt.show()
🌐
GeeksforGeeks
geeksforgeeks.org › python › stem-and-leaf-plots-in-python
Stem and Leaf Plots in Python - GeeksforGeeks
January 30, 2026 - Each value is split into a stem (all but the last digit) and a leaf (the last digit).
🌐
PyPI
pypi.org › project › stemgraphic
stemgraphic · PyPI
John Tukey’s stem-and-leaf plot first appeared in 1970. Although quite useful back then, it cannot handle more than 300 data points and is completely text-based. Stemgraphic is an easy to use python package providing a solution to these limitations (no size limit, graphical tool).
      » pip install stemgraphic
    
Published: Mar 20, 2021
Version: 0.9.1
🌐
Arch Linux
archlinux.org › packages › extra › any › python-stem
Arch Linux - python-stem 1.8.3-4 (any)
View the file list for python-stem · View the soname list for python-stem · Copyright © 2002-2026 Judd Vinet, Aaron Griffin and Levente Polyák. The Arch Linux name and logo are recognized trademarks. Some rights reserved.
🌐
DataCamp
datacamp.com › tutorial › stemming-lemmatization-python
Stemming and Lemmatization in Python | DataCamp
June 1, 2026 - This tutorial covers stemming and lemmatization from a practical standpoint using the Python Natural Language ToolKit (NLTK) package.
🌐
IEEE Xplore
ieeexplore.ieee.org › document › 9388001
STEM and STEAM Technologies in Problem Solving with Python | IEEE Conference Publication | IEEE Xplore
The article deals with the structure and methods of construction of the course "Problem Solving with Python" using STEM and STEAM technologies. The course is built on the principle of "visualization and problem solving head first". The techniques are offered to make the course easy to understand, including operations with NumPy arrays and slices, libraries of the Python ecosystem, domain-specific languages.
🌐
TutorialsPoint
tutorialspoint.com › how-to-a-plot-stem-plot-in-matplotlib-python
How to a plot stem plot in Matplotlib Python?
June 10, 2021 - import matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) markerline, stemlines, baseline = plt.stem(x, y, linefmt='grey', markerfmt='*', bottom=1.1) markerline.set_markerfacecolor('red') plt.show()
🌐
Python.org
discuss.python.org › ideas
Add pathlib.Path.stems - Ideas - Discussions on Python.org
April 20, 2023 - Path.suffix is to Path.stem as Path.suffixes is to …? >>> from pathlib import Path >>> p = Path("CurveFile.vs2022.vcxproj") >>> p.suffix '.vcxproj' >>> p.stem 'CurveFile.vs2022' >>> p.suffixes ['.vs2022', '.vcxproj'] W…