{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e4717649",
   "metadata": {},
   "source": [
    "#15-17 · Binarki i podziały liniowe\n",
    "\n",
    "Praktyka do sekcji [„Pliki binarne i znaki nowej linii”](/pl/chapters/rozdzial-15/15-17-binarnye-fajly-i-perevody-strok.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dd86f23e",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c932620d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T15:53:01.042359Z",
     "iopub.status.busy": "2026-08-18T15:53:01.042248Z",
     "iopub.status.idle": "2026-08-18T15:53:01.064154Z",
     "shell.execute_reply": "2026-08-18T15:53:01.063815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "b'\\n\\x14\\x1e'\n"
     ]
    }
   ],
   "source": [
    "data = bytes([10, 20, 30])\n",
    "with open(\"signal2.bin\", \"wb\") as f:\n",
    "    f.write(data)\n",
    "\n",
    "with open(\"signal2.bin\", \"rb\") as f:\n",
    "    read_data = f.read()\n",
    "print(read_data)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "95eb9e68",
   "metadata": {},
   "source": [
    "## Podstawowa ★ praktyka aktywności – symbole vs. bajty"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f8a5b905",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T15:53:01.065351Z",
     "iopub.status.busy": "2026-08-18T15:53:01.065242Z",
     "iopub.status.idle": "2026-08-18T15:53:01.067626Z",
     "shell.execute_reply": "2026-08-18T15:53:01.067207Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6 14\n"
     ]
    }
   ],
   "source": [
    "text2 = \"Питон🐍\"\n",
    "chars_len2 = len(text2)\n",
    "bytes_len2 = len(text2.encode(\"utf-8\"))\n",
    "print(chars_len2, bytes_len2)"
   ]
  }
 ],
 "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
}
