{"id":314691,"date":"2020-12-11T09:01:45","date_gmt":"2020-12-11T09:01:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=314691"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=314691","title":{"rendered":"Brython: \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c JavaScript \u043d\u0430 Python \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  \u041a \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u043c\u0443 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044e \u043d\u0430\u0448\u0435\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438, \u043d\u0430\u0448\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0430\u0434 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/www.piter.com\/product\/prostoy-python-sovremennyy-stil-programmirovaniya-2-e-izd\">\u043a\u043d\u0438\u0433 \u043f\u043e Python<\/a> \u043d\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f. \u041d\u043e \u043d\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u0438\u0441\u043a \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u2014 \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c Brython \u2014 Python \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432. \u0421\u0442\u0430\u0442\u044c\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u0438\u0432\u0430\u044f \u0438 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f, \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0439 \u0441\u0442\u0438\u043b\u044c. <\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u0430\u0435\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 <a href=\"https:\/\/brython.info\/\">Brython<\/a>, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 Python \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435 (\u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435).<\/p>\n<p>  \u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u044b\u043b\u043e\u0436\u0435\u043d <a href=\"https:\/\/github.com\/RAbraham\/brython-blog\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0417\u0430\u0432\u0438\u0434\u0443\u044f \u0443\u0441\u043f\u0435\u0445\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 JavaScript, \u043f\u0438\u0442\u043e\u043d\u0438\u0441\u0442\u044b-\u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0449\u0438\u043a\u0438 \u0442\u0430\u0439\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0431\u0443\u0434\u0443\u0449\u0435\u0435 Python \u0432 \u044d\u0442\u043e\u043c \u0430\u043f\u043e\u043a\u0430\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0438\u0440\u0435. \u041f\u043e\u0432\u0441\u044e\u0434\u0443 JavaScript, \u043e\u0442\u0436\u0438\u0440\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u044f\u043d\u0443 \u0443 Python. \u0412\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c <a href=\"https:\/\/www.piter.com\/collection\/all\/product\/nodejs-v-deystvii-2-e-izdanie\">Node.js<\/a>, \u044f\u0437\u044b\u043a JavaScript \u0432\u0442\u043e\u0440\u0433\u0441\u044f \u043d\u0430 \u0442\u0435\u0440\u0440\u0438\u0442\u043e\u0440\u0438\u044e Python, \u0438 \u0442\u043e\u0442 \u0443\u0442\u0440\u0430\u0442\u0438\u043b \u0441\u0432\u043e\u044e \u0434\u043e\u043c\u0438\u043d\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0440\u043e\u043b\u044c \u0432\u0441\u0435\u043c\u0438 \u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430, \u0433\u0434\u0435 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u043f\u0435\u0440\u043d\u0438\u0447\u0430\u043b \u0441 Ruby (<a href=\"https:\/\/www.piter.com\/collection\/all\/product\/ruby-obektno-orientirovannoe-proektirovanie\">\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0442\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430<\/a>?). \u0422\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u043b\u0430\u0437\u043a\u0443 \u0432 \u0441\u0430\u043c\u043e\u0435 \u0441\u0435\u0440\u0434\u0446\u0435 \u0442\u0435\u0440\u0440\u0438\u0442\u043e\u0440\u0438\u0438 JavaScript: \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/p>\n<h2>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0432\u0430\u0448\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u044e (\u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u043e \u0431\u0443\u0434\u0443\u0449\u0435\u043c) <\/h2>\n<p>  \u042d\u0442\u0430 \u0434\u0438\u043b\u0435\u043c\u043c\u0430 \u0432\u043e\u043b\u043d\u043e\u0432\u0430\u043b\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0449\u0438\u043a\u043e\u0432. \u0411\u044b\u043b \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0440\u044b\u0446\u0430\u0440\u044c \u043f\u043b\u0430\u0449\u0430 \u0438 \u043a\u0438\u043d\u0436\u0430\u043b\u0430, \u0430\u0432\u0442\u043e\u0440 <a href=\"https:\/\/www.transcrypt.org\/\">Transcrypt<\/a>. \u041e\u043d \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f Python, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043f\u0440\u044f\u043c\u043e \u0432 JavaScript \u041a\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043e\u0442\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c, \u043e\u043d \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0431\u044f \u0438 \u0441\u043b\u0435\u0434\u0430 Python. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u044d\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435.<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0440\u043e\u043a\u0430\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0438. \u041f\u0440\u043e\u0441\u0442\u043e \u0438\u043c\u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u0439 \u0441\u0435\u043c\u044c\u0435\u0439. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043c\u044b\u0441\u043b\u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 <a href=\"https:\/\/hacks.mozilla.org\/2019\/04\/pyodide-bringing-the-scientific-python-stack-to-the-browser\/\">Pyodide<\/a>. \u041e\u043d\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 JavaScript \u0430\u043d\u043a\u043b\u0430\u0432 \u0441 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u043e\u043c Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 Python. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0433\u043e\u043d\u044f\u0442\u044c <a href=\"https:\/\/www.piter.com\/collection\/all\/product\/python-dlya-slozhnyh-zadach-nauka-o-dannyh-i-mashinnoe-obuchenie-2\">\u043b\u044e\u0431\u043e\u0439 \u043a\u043e\u0434 Python<\/a>, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0435\u0433\u043e \u0441\u0442\u0435\u043a\u0430 \u0434\u043b\u044f data science, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a \u044f\u0437\u044b\u043a\u0443 C (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Numpy, Pandas).<\/p>\n<p>  \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435. \u041d\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0435 \u043b\u0435\u043d\u0438\u0432\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0430\u0432\u0442\u043e\u0440\u043e\u043c Pyodide, \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0433\u0440\u0443\u0437\u0438\u043b\u0430\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. <\/p>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0449\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0434\u0443\u0445\u0435 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0449\u0438\u043a\u043e\u0432: \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f Python \u0432 JavaScript, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0432 JavaScript \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (\u0430 \u043d\u0435 \u043a\u0430\u043a Transcrypt, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 JavaScript \u0437\u0430\u0440\u0430\u043d\u0435\u0435). \u0422\u0430\u043a \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0411\u0440\u0430\u0442\u0441\u0442\u0432\u043e Brython. \u041e\u0434\u043d\u0430 \u0437\u043c\u0435\u044f, \u0447\u0442\u043e\u0431 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438\u043c\u0438 \u0432\u0441\u0435\u043c\u0438. <\/p>\n<h2>Hello World<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u2018Hello World\u2019<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0438 \u0434\u0435\u0441\u0430\u043d\u0442 Brython (\u044d\u0442\u043e \u044f \u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435).<\/p>\n<pre><code class=\"xml\">&lt;script type=&quot;text\/javascript&quot;        src=&quot;https:\/\/cdn.jsdelivr.net\/npm\/brython@3.8.9\/brython.min.js&quot;&gt; &lt;\/script&gt; \u0410\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b &lt;body onload=&quot;brython()&quot;&gt; ... &lt;\/body&gt;<\/code><\/pre>\n<p>  \u0412 \u0442\u0435\u0433\u0435 <code>body<\/code>, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435, \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 Brython:<\/p>\n<pre><code class=\"xml\">&lt;script type=&quot;text\/python&quot;&gt; from browser import document  document &lt;= &quot;Hello World&quot; &lt;\/script&gt; <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Hello World \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <code>document<\/code>. \u0425\u043c. \u041e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e. <\/p>\n<p>  \u0412 \u043f\u043e\u043b\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u2014 \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;meta charset=&quot;utf-8&quot;&gt;     &lt;script type=&quot;text\/javascript&quot;         src=&quot;https:\/\/cdn.jsdelivr.net\/npm\/brython@3.8.8\/brython.min.js&quot;&gt;     &lt;\/script&gt; &lt;\/head&gt;  &lt;body onload=&quot;brython()&quot;&gt;  &lt;script type=&quot;text\/python&quot;&gt; from browser import document  document &lt;= &quot;Hello World&quot; &lt;\/script&gt; &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u201cHello World\u201d.<\/p>\n<h2>\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u043d\u0430 Brython. \u0412\u0435\u0441\u044c \u0435\u0433\u043e \u043a\u043e\u0434 \u0432\u044b\u043b\u043e\u0436\u0435\u043d <a href=\"https:\/\/github.com\/RAbraham\/brython-blog\/blob\/master\/calculator.html\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3j\/u7\/xm\/3ju7xmnpfev_bnaosovnxqahzm8.png\"><\/p>\n<p>  \u0414\u0430, \u0432\u044b \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c.<\/p>\n<pre><code class=\"python\">from browser import document, html calc = html.TABLE() <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u044f\u0434. \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b (\u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e <code>result<\/code>) \u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 C.<\/p>\n<pre><code class=\"python\">calc &lt;= html.TR(html.TH(html.DIV(&quot;0&quot;, id=&quot;result&quot;), colspan=3) +                 html.TD(&quot;C&quot;))<\/code><\/pre>\n<p>  \u0414\u0430, \u044f \u0442\u043e\u0436\u0435 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u0432\u0435\u0440\u0435\u043d \u0432 \u044d\u0442\u043e\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0441 <code>&lt;=<\/code>. \u041d\u043e, \u043f\u043e\u0441\u0443\u0434\u0438\u0442\u0435 \u0441\u0430\u043c\u0438, \u0442\u0430\u043a\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u0438 \u043d\u0430 \u043d\u0435\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443<\/p>\n<pre><code class=\"python\">lines = [&quot;789\/&quot;, &quot;456*&quot;, &quot;123-&quot;, &quot;0.=+&quot;] calc &lt;= (html.TR(html.TD(x) for x in line) for line in lines)<\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u043e\u0431\u0430\u0432\u0438\u043c <code>calc<\/code> \u0432 <code>document<\/code>.<\/p>\n<pre><code class=\"python\">document &lt;= calc<\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u041a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e? \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 result, \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0436\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438.<\/p>\n<pre><code class=\"python\">result = document[&quot;result&quot;] # \u043f\u0440\u044f\u043c\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043f\u043e \u0435\u0433\u043e id<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c <code>result<\/code> \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0436\u0430\u0442 \u043b\u044e\u0431\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0414\u043e\u0432\u0435\u0440\u0438\u043c\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c Brython \u0438 \u0441\u043e\u0447\u0442\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 <code>result<\/code> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u044b \u043d\u0430\u0436\u0430\u043b\u0438.<\/p>\n<pre><code class=\"python\">def action(event):     &quot;&quot;&quot;\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 &quot;click&quot; \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440\u0430.&quot;&quot;&quot;     # \u042d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u043d\u0430\u0436\u0430\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 &quot;target&quot;      # \u043e\u0431\u044a\u0435\u043a\u0442\u0430 event      element = event.target     # \u0422\u0435\u043a\u0441\u0442, \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0435, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 &quot;text&quot; \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430     value = element.text     if value not in &quot;=C&quot;:         # \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c         if result.text in [&quot;0&quot;, &quot;error&quot;]:             result.text = value         else:             result.text = result.text + value     elif value == &quot;C&quot;:         # \u0441\u0431\u0440\u043e\u0441         result.text = &quot;0&quot;     elif value == &quot;=&quot;:         # \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0432 \u043f\u043e\u043b\u0435 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c         try:             result.text = eval(result.text)         except:             result.text = &quot;error&quot;<\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c <code>click<\/code> \u043d\u0430 \u0432\u0441\u0435\u0445 \u043a\u043d\u043e\u043f\u043a\u0430\u0445.<\/p>\n<pre><code class=\"python\">for button in document.select(&quot;td&quot;):     button.bind(&quot;click&quot;, action)<\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u0442\u0435 \u043a\u0430\u043a \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u043e, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e, Brython \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043c\u043d\u0435 \u0448\u0435\u0434\u0435\u0432\u0440\u043e\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0439 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u043b\u044e\u0431\u0432\u0438 \u043a \u044f\u0437\u044b\u043a\u0443 Python. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0438\u043c \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0443 \u0432 <a href=\"https:\/\/github.com\/brython-dev\/brython\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> \u043d\u0430 Github!<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/532454\/\"> https:\/\/habr.com\/ru\/company\/piter\/blog\/532454\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  \u041a \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u043c\u0443 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044e \u043d\u0430\u0448\u0435\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438, \u043d\u0430\u0448\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0430\u0434 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/www.piter.com\/product\/prostoy-python-sovremennyy-stil-programmirovaniya-2-e-izd\">\u043a\u043d\u0438\u0433 \u043f\u043e Python<\/a> \u043d\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f. \u041d\u043e \u043d\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u0438\u0441\u043a \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u2014 \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c Brython \u2014 Python \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432. \u0421\u0442\u0430\u0442\u044c\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u0438\u0432\u0430\u044f \u0438 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f, \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0439 \u0441\u0442\u0438\u043b\u044c. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-314691","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=314691"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314691\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=314691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=314691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=314691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}