{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "29ac6857",
   "metadata": {},
   "source": [
    "# 15-09 · Разбираем путь: name, stem, suffix, parent\n",
    "\n",
    "Практика к разделу [«Разбираем путь»](../../site/chapters/glava-15/15-09-razbiraem-put.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "967ce624",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "280edf2c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T15:52:54.652563Z",
     "iopub.status.busy": "2026-08-18T15:52:54.652428Z",
     "iopub.status.idle": "2026-08-18T15:52:54.668467Z",
     "shell.execute_reply": "2026-08-18T15:52:54.667957Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "scores.txt\n",
      "scores\n",
      ".txt\n",
      "data\n"
     ]
    }
   ],
   "source": [
    "from pathlib import Path\n",
    "\n",
    "path = Path(\"data/scores.txt\")\n",
    "print(path.name)\n",
    "print(path.stem)\n",
    "print(path.suffix)\n",
    "print(path.parent.as_posix())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1bc5474e",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Разберите путь без расширения и убедитесь, что suffix у него — пустая строка."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d649f240",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T15:52:54.669484Z",
     "iopub.status.busy": "2026-08-18T15:52:54.669301Z",
     "iopub.status.idle": "2026-08-18T15:52:54.671854Z",
     "shell.execute_reply": "2026-08-18T15:52:54.671376Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True True\n"
     ]
    }
   ],
   "source": [
    "from pathlib import Path\n",
    "\n",
    "path_bez_suffiksa = Path(\"data/README\")\n",
    "suffix_pust = path_bez_suffiksa.suffix == \"\"\n",
    "stem_ravno_name = path_bez_suffiksa.stem == path_bez_suffiksa.name\n",
    "print(suffix_pust, stem_ravno_name)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
