{"id":444899,"date":"2025-01-13T21:00:05","date_gmt":"2025-01-13T21:00:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=444899"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=444899","title":{"rendered":"<span>Brython: Python \u0432 \u0432\u0430\u0448\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 (\u0447.2)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"\/ru\/articles\/872822\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1<\/a> \u2022 <span>\u0427\u0430\u0441\u0442\u044c 2<\/span> \u2022 <a href=\"\/ru\/articles\/873176\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 3<\/a> \u2022 <a href=\"\/ru\/article\/872792\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 4<\/a><\/p>\n<h3>\u041f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b Brython<\/h3>\n<p><a class=\"anchor\" name=\"understanding-how-brython-works\" id=\"understanding-how-brython-works\"><\/a><\/p>\n<p>\u0412\u0430\u0448\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Brython \u0434\u0430\u043b\u043e \u0432\u0430\u043c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f. \u0412\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Python \u043d\u0430 JavaScript.<\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u043e \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0442\u043e\u0440 Python \u0432 JavaScript \u0438 \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0430\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 JavaScript: <\/p>\n<ul>\n<li>\n<p><strong>brython.js<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044f\u0434\u0440\u043e\u043c \u044f\u0437\u044b\u043a\u0430 Brython, \u043a\u0430\u043a \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"#brython-core-components\" rel=\"noopener noreferrer nofollow\">\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Brython<\/a>.<\/p>\n<\/li>\n<li>\n<p><strong>brython_stdlib.js<\/strong> \u2014 \u044d\u0442\u043e <a href=\"#brython-standard-library\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Brython<\/a>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <em>brython()<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 Python, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439\u0441\u044f \u0432 \u0442\u0435\u0433\u0430\u0445 <em>script<\/em> \u0441 \u0442\u0438\u043f\u043e\u043c <em>text\/python<\/em>. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445 \u0432\u044b \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b Brython.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Brython<\/h4>\n<p><a class=\"anchor\" name=\"brython-core-components\" id=\"brython-core-components\"><\/a><\/p>\n<p>\u042f\u0434\u0440\u043e Brython \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <em>brython.js<\/em> \u0438\u043b\u0438 \u0432 <em>brython.min.js<\/em>, \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0432\u0438\u0436\u043a\u0430 Brython. \u041e\u0431\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p><strong>brython()<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f JavaScript, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d JavaScript. \u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043a\u043e\u0434 Python \u0431\u0435\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u042d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f JavaScript, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>__BRYTHON__<\/strong> \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 JavaScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Python. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Brython. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043a\u043e\u0434 Brython \u2014 \u043a\u0430\u043a JavaScript, \u0442\u0430\u043a \u0438 Python, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 <em>__BRYTHON__<\/em>. \u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u043e \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b<\/strong> \u2014 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html\" rel=\"noopener noreferrer nofollow\">\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 Python<\/a> \u0432 JavaScript. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/src\/py_int.js\" rel=\"noopener noreferrer nofollow\">py_int.js<\/a>, <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/src\/py_string.js\" rel=\"noopener noreferrer nofollow\">py_string.js<\/a> \u0438 <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/src\/py_dict.js\" rel=\"noopener noreferrer nofollow\">py_dicts.js<\/a> \u2014 \u044d\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#numeric-types-int-float-complex\" rel=\"noopener noreferrer nofollow\">int<\/a>, <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#text-sequence-type-str\" rel=\"noopener noreferrer nofollow\">str<\/a> \u0438 <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#mapping-types-dict\" rel=\"noopener noreferrer nofollow\">dict<\/a>.<\/p>\n<\/li>\n<li>\n<p><strong>browser<\/strong> \u2014 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/doc\/en\/browser.md\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0434\u0443\u043b\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b JavaScript, \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043d\u044b\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b DOM \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/brython.info\/static_doc\/en\/dom_api.html\" rel=\"noopener noreferrer nofollow\"><em>document<\/em><\/a> \u0438 \u043e\u043a\u043d\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/brython.info\/static_doc\/en\/jsobjects.html\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u044a\u0435\u043a\u0442\u0430 <em>window<\/em><\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0432 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435.<\/p>\n<h4>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Brython<\/h4>\n<p><a class=\"anchor\" name=\"brython-standard-library\" id=\"brython-standard-library\"><\/a><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0431\u0430\u0437\u043e\u0432\u043e\u043c Brython-\u0441\u043a\u0440\u0438\u043f\u0442\u0435 <em>brython.js<\/em> \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u043e \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0435\u043c\u0443 <em>brython_stdlib.js<\/em>.<\/p>\n<p><em>brython_stdlib.js<\/em> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python. \u041f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Brython \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python \u0432 JavaScript \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 <em>brython_stdlib.js<\/em>.<\/p>\n<p>Brython \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u044b\u043c \u043a <a href=\"https:\/\/www.python.org\/\" rel=\"noopener noreferrer nofollow\">CPython<\/a>, \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Python. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e CPython \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c\u0438 <a href=\"https:\/\/realpython.com\/cpython-source-code-guide\/\" rel=\"noopener noreferrer nofollow\">Your Guide to the CPython Source Code<\/a> \u0438 <a href=\"https:\/\/realpython.com\/products\/cpython-internals-book\/\" rel=\"noopener noreferrer nofollow\">CPython Internals<\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 Brython \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0438 \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>os.open()<\/em> \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0440\u0435\u0434\u0435 Brython:<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; import os &gt;&gt;&gt; os.unlink() Traceback (most recent call last):   File , line 1, in  NotImplementedError: posix.unlink is not implemented<\/code><\/pre>\n<p><a href=\"https:\/\/docs.python.org\/3\/library\/os.html#os.unlink\" rel=\"noopener noreferrer nofollow\"><em>os.unlink()<\/em><\/a> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u0441\u0440\u0435\u0434\u044b \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e, \u0430 <a href=\"https:\/\/wicg.github.io\/entries-api\/\" rel=\"noopener noreferrer nofollow\">API \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432<\/a> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0447\u0435\u0440\u043d\u043e\u0432\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c.<\/p>\n<p>Brython \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 Python. \u041e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <a href=\"https:\/\/realpython.com\/build-python-c-extension-module\/\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0434\u0443\u043b\u0438 Python, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 C<\/a>, \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043d\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 JavaScript. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/docs.python.org\/3\/library\/hashlib.html\" rel=\"noopener noreferrer nofollow\"><em>hashlib<\/em><\/a> \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/python\/cpython\/blob\/37834136d0afe51d274bfc79d8705514cbe73727\/Modules\/hashlib.h\" rel=\"noopener noreferrer nofollow\">C<\/a> \u0432 CPython \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/02365fa0eb746fca7b044968335c9c954d7e55ff\/www\/src\/libs\/hashlib.js\" rel=\"noopener noreferrer nofollow\">JavaScript<\/a> \u0432 Brython. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e <a href=\"https:\/\/brython.info\/static_doc\/en\/stdlib.html\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 Brython<\/a>, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 CPython.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Python \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c <em>brython_stdlib.js<\/em> \u0438\u043b\u0438 <em>brython_stdlib.min.js<\/em>.<\/p>\n<h4>Brython \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438<\/h4>\n<p><a class=\"anchor\" name=\"brython-in-action\" id=\"brython-in-action\"><\/a><\/p>\n<p>\u041a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0432\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u0430\u0434\u0430\u0435\u0442\u0435\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043a\u0430\u043a Brython \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e JavaScript. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u043d\u0430 Python \u0432 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>\u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"#cdn-installation\" rel=\"noopener noreferrer nofollow\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 CDN<\/a> \u0432\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;script             src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/brython\/3.13.0\/brython.js\"&gt;         &lt;\/script&gt;     &lt;\/head&gt;     &lt;body onload=\"brython()\"&gt;         &lt;script type=\"text\/python\"&gt;             import browser             browser.alert(\"Hello Real Python!\")         &lt;\/script&gt;     &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b <em>brython()<\/em> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u0434 Python, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439\u0441\u044f \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 <em>&lt;script type=&#187;text\/python&#187;&gt;<\/em><\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 Python-\u043a\u043e\u0434 \u0432 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 JavaScript-\u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 JavaScript \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/eval\" rel=\"noopener noreferrer nofollow\"><em>eval()<\/em><\/a><\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434 Python \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 HTML-\u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"xml\">&lt;script type=\"text\/python\"&gt;     import browser     browser.alert(\"Hello Real Python!\") &lt;\/script&gt;<\/code><\/pre>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u0434 Python \u0438\u0437 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"xml\">import browser browser.alert(\"Hello Real Python!\")<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u0439\u043b Python \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">import browser browser.alert(\"Hello Real Python!\")<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 Python \u0438 \u043a\u043e\u0434\u0430 HTML \u2014 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 HTML JavaScript, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 HTML Python.<\/p>\n<h4>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Brython<\/h4>\n<p><a class=\"anchor\" name=\"brythons-internals\" id=\"brythons-internals\"><\/a><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 Python \u0432 JavaScript. \u0415\u0441\u043b\u0438 \u0432\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u044d\u0442\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2014 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Brython, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 <a href=\"https:\/\/brython.info\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 Brython<\/a>.<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>Cmd+Alt+I<\/code> \u043d\u0430 Mac \u0438\u043b\u0438 <code>Ctrl+Shift+I<\/code> \u043d\u0430 Windows \u0438 Linux.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 JavaScript <a href=\"https:\/\/en.wikipedia.org\/wiki\/Read%E2%80%93eval%E2%80%93print_loop\" rel=\"noopener noreferrer nofollow\">REPL<\/a> \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"javascript\">&gt; eval(__BRYTHON__.python_to_js(\"import browser; browser.console.log('Hello Brython!')\"));<\/code><\/pre>\n<p><em>python_to_js()<\/em> \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 Python \u0432 JavaScript, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 JavaScript \u0432 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/231\/e7f\/0fd\/231e7f0fd20daa770caed619c0b927f5.png\" alt=\"\u041e\u0446\u0435\u043d\u043a\u0430 Python \u0432 JavaScript\" title=\"\u041e\u0446\u0435\u043d\u043a\u0430 Python \u0432 JavaScript\" width=\"810\" height=\"421\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/231\/e7f\/0fd\/231e7f0fd20daa770caed619c0b927f5.png\"\/><\/p>\n<div><figcaption>\u041e\u0446\u0435\u043d\u043a\u0430 Python \u0432 JavaScript<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 <em>eval()<\/em> \u043a \u043a\u043e\u0434\u0443 Brython \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 <em>&#171;Hello Brython!&#187;<\/em>. <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Functions\" rel=\"noopener noreferrer nofollow\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f JavaScript<\/a> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>undefined<\/em>, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 JavaScript.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Brython \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 <em>__BRYTHON__<\/em> \u043c\u043e\u0434\u0443\u043b\u0435 JavaScript. \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a Brython \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438. \u0417\u043d\u0430\u043d\u0438\u0435 <em>__BRYTHON__<\/em> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u0434 Brython \u0438 \u0434\u0430\u0436\u0435 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u043a\u043b\u0430\u0434 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u043c\u0435\u0440\u0435 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044f \u043e\u043f\u044b\u0442\u0430. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 JavaScript <em>__BRYTHON__<\/em> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 JavaScript, \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u0438 JavaScript \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Brython \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/h3>\n<p><a class=\"anchor\" name=\"using-brython-in-the-browser\" id=\"using-brython-in-the-browser\"><\/a><\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u043d\u0438\u0439 \u043e Brython, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438. \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Base64\" rel=\"noopener noreferrer nofollow\">Base64<\/a>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0441 API DOM \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 JavaScript.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435, \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 <a href=\"https:\/\/github.com\/realpython\/materials\/tree\/master\/brython\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443<\/a>.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c DOM \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python \u0438 HTML.<\/p>\n<h4>API DOM \u0432 Brython<\/h4>\n<p><a class=\"anchor\" name=\"the-dom-api-in-brython\" id=\"the-dom-api-in-brython\"><\/a><\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f\u043c\u0438 DOM, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0432 Brython, \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 <a href=\"https:\/\/docs.python.org\/3\/library\/base64.html\" rel=\"noopener noreferrer nofollow\">Base64<\/a>. \u0413\u043e\u0442\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fb1\/042\/58d\/fb104258d325110ef5c5305d68453ed3.png\" alt=\"\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b Base64\" title=\"\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b Base64\" width=\"808\" height=\"557\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fb1\/042\/58d\/fb104258d325110ef5c5305d68453ed3.png\"\/><\/p>\n<div><figcaption>\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b Base64<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 HTML-\u0444\u0430\u0439\u043b \u0438 \u043d\u0430\u0437\u043e\u0432\u0438\u0442\u0435 \u0435\u0433\u043e <em>index.html<\/em>:<\/p>\n<pre><code class=\"xml\">&lt;!-- index.html --&gt; &lt;!DOCTYPE html &gt; &lt;html&gt;   &lt;head&gt;     &lt;meta charset=\"utf-8\"\/&gt;     &lt;link rel=\"stylesheet\"           href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/pure\/3.0.0\/pure-min.css\" \/&gt;     &lt;script         src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/brython\/3.13.0\/brython.min.js\"&gt;     &lt;\/script&gt;     &lt;script         src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/brython\/3.13.0\/brython_stdlib.min.js\"&gt;     &lt;\/script&gt;     &lt;script src=\"main.py\" type=\"text\/python\" defer&gt;&lt;\/script&gt;     &lt;style&gt;body { padding: 30px; }&lt;\/style&gt;   &lt;\/head&gt;   &lt;body onload=\"brython()\"&gt;     &lt;form class=\"pure-form\" onsubmit=\"return false;\"&gt;       &lt;fieldset&gt;         &lt;legend&gt;Base64 Calculator&lt;\/legend&gt;         &lt;input type=\"text\" id=\"text-src\" placeholder=\"Text to Encode\" \/&gt;         &lt;button           type=\"submit\" id=\"submit\"           class=\"pure-button pure-button-primary\"           autocomplete=\"off\"&gt;Ok&lt;\/button&gt;         &lt;button id=\"clear-btn\" class=\"pure-button\"&gt;Clear&lt;\/button&gt;       &lt;\/fieldset&gt;     &lt;\/form&gt;     &lt;div id=\"b64-display\"&gt;&lt;\/div&gt;   &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 HTML-\u043a\u043e\u0434 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u043a\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e Python:<\/p>\n<ul>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 7<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 <a href=\"https:\/\/purecss.io\/\" rel=\"noopener noreferrer nofollow\">PureCSS<\/a> \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0438\u043b\u044f HTML \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u042d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b Brython.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 9<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0434\u0432\u0438\u0436\u043a\u0430 Brython.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 12<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Brython.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 14<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 <em>main.py<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/script\" rel=\"noopener noreferrer nofollow\">defer<\/a>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043e\u0446\u0435\u043d\u043a\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e Brython \u0438 \u043b\u044e\u0431\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b Python \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c <em>brython()<\/em>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 21<\/strong> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0435 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/input\" rel=\"noopener noreferrer nofollow\"><em>input<\/em><\/a>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0438 22\u201325<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/button\" rel=\"noopener noreferrer nofollow\"><em>button<\/em><\/a>, \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 <em>main.py<\/em> \u043d\u0438\u0436\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 26<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 <em>button<\/em> \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0432 <em>main.py<\/em> \u043d\u0438\u0436\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0412 <strong>\u0441\u0442\u0440\u043e\u043a\u0435 29<\/strong> \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/div\" rel=\"noopener noreferrer nofollow\"><em>div<\/em><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u043c \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 Python <em>main.py<\/em> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">from browser import document, prompt, html, alert import base64  b64_map = {}  def base64_compute(_):     value = document[\"text-src\"].value     if not value:         alert(\"You need to enter a value\")         return     if value in b64_map:         alert(f\"'The base64 value of '{value}' already exists: '{b64_map[value]}'\")         return     b64data = base64.b64encode(value.encode()).decode()     b64_map[value] = b64data     display_map()  def clear_map(_) -&gt; None:     b64_map.clear()     document[\"b64-display\"].clear()  def display_map() -&gt; None:     table = html.TABLE(Class=\"pure-table\")     table &lt;= html.THEAD(html.TR(html.TH(\"Text\") + html.TH(\"Base64\")))     table &lt;= (html.TR(html.TD(key) + html.TD(b64_map[key])) for key in b64_map)     base64_display = document[\"b64-display\"]     base64_display.clear()     base64_display &lt;= table     document[\"text-src\"].value = \"\"  document[\"submit\"].bind(\"click\", base64_compute) document[\"clear-btn\"].bind(\"click\", clear_map)<\/code><\/pre>\n<p>\u041a\u043e\u0434 Python \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f DOM:<\/p>\n<ul>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 1<\/strong> \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 DOM \u0438 \u043a\u043e\u0434\u043e\u043c API \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0432 <em>brython.min.js<\/em>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 2<\/strong> \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 <em>base64<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Brython, <em>brython_stdlib.min.js<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0412 <strong>\u0441\u0442\u0440\u043e\u043a\u0435 4<\/strong> \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/realpython.com\/python-dicts\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043b\u043e\u0432\u0430\u0440\u044c<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0440\u043e\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 6<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <em>base64_compute()<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 Base64-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u043e\u043b\u0435 \u0432\u0432\u043e\u0434\u0430, \u0441 ID <em>text-src<\/em>. \u042d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u042d\u0442\u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432 Brython \u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432 JavaScript. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c _\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"https:\/\/google.github.io\/styleguide\/pyguide.html#214-decision\" rel=\"noopener noreferrer nofollow\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043f\u043e \u0441\u0442\u0438\u043b\u044e Google Python<\/a>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 7<\/strong> \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 DOM, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>text-src<\/em>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 18<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <em>clear_map()<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 22<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 <em>display_map()<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0435\u0440\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 <em>b64_map<\/em> \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0438\u0445 \u043f\u043e\u0434 \u0444\u043e\u0440\u043c\u043e\u0439 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 26<\/strong> \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 DOM \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <em>text-src<\/em>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 29<\/strong> \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 DOM \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <em>text-src<\/em>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 31<\/strong> \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/SVG\/Attribute\/onclick\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u0431\u044b\u0442\u0438\u0435 <em>onclick<\/em><\/a> \u043a\u043d\u043e\u043f\u043a\u0438 <em>submit<\/em> \u043a <em>base64_compute()<\/em>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 32<\/strong> \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <em>onclick<\/em> \u043a\u043d\u043e\u043f\u043a\u0438 <em>clear-btn<\/em> \u043a <em>clear_map()<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f DOM Brython \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0432\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<ol>\n<li>\n<p><em>&lt;=<\/em> \u2014 \u043d\u043e\u0432\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f Brython, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0442\u043e\u043c\u043a\u0430 \u043a \u0443\u0437\u043b\u0443. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 <em>display_map()<\/em> \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 22.<\/p>\n<\/li>\n<li>\n<p><em>+<\/em> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u043d\u043e\u0439 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Element\/insertAdjacentHTML\" rel=\"noopener noreferrer nofollow\"><em>Element.insertAdjacentHTML(&#8216;afterend&#8217;)<\/em><\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0443\u0437\u043b\u044b.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043e\u0431\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438, \u0432\u0437\u044f\u0442\u043e\u043c \u0438\u0437 <em>display_map()<\/em>:<\/p>\n<pre><code class=\"python\">table &lt;= html.THEAD(html.TR(html.TH(\"Text\") + html.TH(\"Base64\")))<\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u0442\u0435 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434 \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/table\" rel=\"noopener noreferrer nofollow\">\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/a> <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/thead\" rel=\"noopener noreferrer nofollow\">\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/a>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/tr\" rel=\"noopener noreferrer nofollow\">\u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/a>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u043c\u0435\u0436\u043d\u044b\u0445 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/td\" rel=\"noopener noreferrer nofollow\">\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u044f\u0447\u0435\u0435\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/a>. \u041e\u043d \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 HTML-\u043a\u043e\u0434:<\/p>\n<pre><code class=\"xml\">&lt;table&gt; &lt;thead&gt;&lt;tr&gt;&lt;th&gt;Text&lt;\/th&gt;&lt;th&gt;Base64&lt;\/th&gt;&lt;\/tr&gt;&lt;\/thead&gt; &lt;\/table&gt;<\/code><\/pre>\n<p>HTML-\u043a\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0412\u043e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"xml\">&lt;table&gt;   &lt;thead&gt;     &lt;tr&gt;       &lt;th&gt;Text&lt;\/th&gt;       &lt;th&gt;Base64&lt;\/th&gt;     &lt;\/tr&gt;   &lt;\/thead&gt; &lt;\/table&gt;<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 Brython, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from browser import html &gt;&gt;&gt; table = html.TABLE() &gt;&gt;&gt; table &lt;= html.THEAD(html.TR(html.TH(\"Text\") + html.TH(\"Base64\"))) &gt;&gt;&gt; table.outerHTML '&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Text&lt;\/th&gt;&lt;th&gt;Base64&lt;\/th&gt;&lt;\/tr&gt;&lt;\/thead&gt;&lt;\/table&gt;'<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440. \u041a\u0430\u043a \u0438 \u043f\u0440\u0435\u0436\u0434\u0435, \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 Python \u0432 \u0442\u043e\u043c \u0436\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435, \u0447\u0442\u043e \u0438 \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 <em>index.html<\/em> \u0438 <em>main.py<\/em>:<\/p>\n<pre><code class=\"bash\">$ python3 -m http.server Serving HTTP on :: port 8000 (http:\/\/[::]:8000\/) ...<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0430 <a href=\"http:\/\/localhost:8000\" rel=\"noopener noreferrer nofollow\"><em>http:\/\/localhost:8000<\/em><\/a>. \u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cb0\/e13\/881\/cb0e13881d10419fecd7101eabadc0fd.png\" alt=\"\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b Base64\" title=\"\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b Base64\" width=\"808\" height=\"557\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cb0\/e13\/881\/cb0e13881d10419fecd7101eabadc0fd.png\"\/><\/p>\n<div><figcaption>\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b Base64<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"\/ru\/articles\/873176\/#browser-web-api\" rel=\"noopener noreferrer nofollow\">Web API \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430<\/a>, \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<h4>\u0418\u043c\u043f\u043e\u0440\u0442 \u0432 Brython<\/h4>\n<p><a class=\"anchor\" name=\"import-in-brython\" id=\"import-in-brython\"><\/a><\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>import<\/em> \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c Python \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c Brython, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0432 JavaScript.<\/p>\n<p><a href=\"https:\/\/docs.python.org\/3\/tutorial\/modules.html\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0434\u0443\u043b\u0438 Python<\/a> \u2014 \u044d\u0442\u043e \u0444\u0430\u0439\u043b\u044b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c <em>.py<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043b\u0438\u0431\u043e, \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u0430 Python, \u0432 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0444\u0430\u0439\u043b __<em>init__.py<\/em>. \u0427\u0442\u043e\u0431\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 Python \u0432 \u0432\u0430\u0448 \u043a\u043e\u0434 Brython, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 Python \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c <a href=\"https:\/\/realpython.com\/python-modules-packages\/\" rel=\"noopener noreferrer nofollow\">Python Modules and Packages \u2013 An Introduction<\/a>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0443\u0447\u0438\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 Python \u0432 \u043a\u043e\u0434 Brython, \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"\/ru\/articles\/872822\/#pypi-installation\" rel=\"noopener noreferrer nofollow\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PyPI<\/a>, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0439\u0442\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443 Python, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 Brython \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0435\u0433\u043e <em>index.html<\/em> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; &lt;html&gt;  &lt;head&gt; &lt;meta charset=\"utf-8\"&gt; &lt;script type=\"text\/javascript\" src=\"brython.js\"&gt;&lt;\/script&gt; &lt;script type=\"text\/javascript\" src=\"brython_stdlib.js\"&gt;&lt;\/script&gt; &lt;\/head&gt;  &lt;body onload=\"brython()\"&gt;  &lt;script type=\"text\/python\"&gt; from browser import document, html, window import sys import functional  selection = functional.take(10, range(10000)) numbers = ', '.join([str(x) for x in selection])  document &lt;= html.P(f\"{sys.version=}\") document &lt;= html.P(f\"{numbers=}\") &lt;\/script&gt;  &lt;\/body&gt;  &lt;\/html&gt;<\/code><\/pre>\n<p>HTML-\u0444\u0430\u0439\u043b \u0432\u044b\u0448\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u0438, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u044f\u0434\u0440\u0430 \u0434\u0432\u0438\u0436\u043a\u0430 (<em>browser<\/em>), \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (<em>sys<\/em>) \u0438 \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f Python (<em>functional<\/em>). \u0412\u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <em>functional.py<\/em>:<\/p>\n<pre><code class=\"python\">import itertools  def take(n, iterable):     \"Return first n items of the iterable as a list\"     return list(itertools.islice(iterable, n))<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 <em>take()<\/em>, \u043e\u0434\u043d\u0443 \u0438\u0437 <a href=\"https:\/\/docs.python.org\/3\/library\/itertools.html#itertools-recipes\" rel=\"noopener noreferrer nofollow\">\u0443\u0442\u0438\u043b\u0438\u0442 <em>itertools<\/em><\/a>. <em>take()<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0435 <em>n<\/em> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041e\u043d \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <em>itertools.slice()<\/em>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b <em>index.html<\/em> \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<pre><code class=\"bash\">Traceback (most recent call last):   File file:\/\/\/Users\/andre\/brython\/code\/import\/index.html\/__main__   line 3, in      import functional ModuleNotFoundError: functional<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442 \u043c\u043e\u0434\u0443\u043b\u044f Python \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 <a href=\"http:\/\/localhost:8000\" rel=\"noopener noreferrer nofollow\"><em>http:\/\/localhost:8000<\/em><\/a>. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/08c\/fbc\/a92\/08cfbca92bf8c52c106db6f7e87d0b38.png\" alt=\"\u0418\u043c\u043f\u043e\u0440\u0442 Python\" title=\"\u0418\u043c\u043f\u043e\u0440\u0442 Python\" width=\"796\" height=\"323\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/08c\/fbc\/a92\/08cfbca92bf8c52c106db6f7e87d0b38.png\"\/><\/p>\n<div><figcaption>\u0418\u043c\u043f\u043e\u0440\u0442 Python<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <em>functional.py<\/em> \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <em>import functional<\/em>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0431\u043e\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <em>sys.version<\/em> \u0438 <em>numbers<\/em> \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 HTML-\u0444\u0430\u0439\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Python \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c.<\/p>\n<h4>\u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0430<\/h4>\n<p><a class=\"anchor\" name=\"reduce-import-size\" id=\"reduce-import-size\"><\/a><\/p>\n<p>\u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 JavaScript \u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Python \u0432 JavaScript \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>brython-cli<\/em> \u0441 \u043e\u043f\u0446\u0438\u0435\u0439 <em>make_modules<\/em>:<\/p>\n<pre><code class=\"bash\">$ brython-cli make_modules Create brython_modules.js with all the modules used by the application searching brython_stdlib.js... finding packages... script in html index.html<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 <em>brython_modules.js<\/em>, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>head<\/em> \u0432 <em>index.html<\/em> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"xml\">&lt;head&gt; &lt;meta charset=\"utf-8\"&gt; &lt;script type=\"text\/javascript\" src=\"brython.js\"&gt;&lt;\/script&gt; &lt;script type=\"text\/javascript\" src=\"brython_modules.js\"&gt;&lt;\/script&gt; &lt;\/head&gt;<\/code><\/pre>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 4 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043c\u0435\u043d\u0435\u043d \u0441 <em>brython_stdlib.js<\/em> \u043d\u0430 <em>brython_modules.js<\/em>.<\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c <em>index.html<\/em> \u0438\u043b\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0442\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u0441\u0432\u043e\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u0435\u0433\u043e <em>functional.py<\/em>, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u0434 \u0431\u044b\u043b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u0432 JavaScript \u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d \u0432 <em>brython_modules.js<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c <em>brython_stdlib.js<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 <em>brython-cli make_modules<\/em> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c python \u0432 \u043a\u043e\u0434 JavaScript. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>: \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0443 \u043c\u043e\u0434\u0443\u043b\u044f Python, \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u044f Python \u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c <em>script<\/em> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>script<\/em>:<\/p>\n<\/blockquote>\n<pre><code>&lt;script src=\"main.py\" type=\"text\/python\"&gt;&lt;\/script&gt;<\/code><\/pre>\n<blockquote>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f Brython \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <em>script<\/em>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043d\u0430 Python-\u0444\u0430\u0439\u043b, \u043e\u043d\u0430 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c Ajax-\u0432\u044b\u0437\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 JavaScript \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e:<\/p>\n<\/blockquote>\n<pre><code class=\"bash\">IOError: can't load external script at file:\/\/\/project\/main.py (Ajax calls not supported with protocol file:\/\/\/)<\/code><\/pre>\n<blockquote>\n<p>\u0417\u0430\u0449\u0438\u0442\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 <em>main.py<\/em> \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u042d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0441\u043c. <a href=\"https:\/\/brython.info\/static_doc\/en\/file_or_http.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e Brython<\/a>.<\/p>\n<\/blockquote>\n<p><a href=\"\/ru\/articles\/873176\/\" rel=\"noopener noreferrer nofollow\">\u0414\u0430\u043b\u0435\u0435..<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/873174\/\"> https:\/\/habr.com\/ru\/articles\/873174\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"\/ru\/articles\/872822\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1<\/a> \u2022 <span>\u0427\u0430\u0441\u0442\u044c 2<\/span> \u2022 <a href=\"\/ru\/articles\/873176\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 3<\/a> \u2022 <a href=\"\/ru\/article\/872792\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 4<\/a><\/p>\n<h3>\u041f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b Brython<\/h3>\n<p><a class=\"anchor\" name=\"understanding-how-brython-works\" id=\"understanding-how-brython-works\"><\/a><\/p>\n<p>\u0412\u0430\u0448\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Brython \u0434\u0430\u043b\u043e \u0432\u0430\u043c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f. \u0412\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Python \u043d\u0430 JavaScript.<\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u043e \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0442\u043e\u0440 Python \u0432 JavaScript \u0438 \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0430\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 JavaScript: <\/p>\n<ul>\n<li>\n<p><strong>brython.js<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044f\u0434\u0440\u043e\u043c \u044f\u0437\u044b\u043a\u0430 Brython, \u043a\u0430\u043a \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"#brython-core-components\" rel=\"noopener noreferrer nofollow\">\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Brython<\/a>.<\/p>\n<\/li>\n<li>\n<p><strong>brython_stdlib.js<\/strong> \u2014 \u044d\u0442\u043e <a href=\"#brython-standard-library\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Brython<\/a>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <em>brython()<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 Python, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439\u0441\u044f \u0432 \u0442\u0435\u0433\u0430\u0445 <em>script<\/em> \u0441 \u0442\u0438\u043f\u043e\u043c <em>text\/python<\/em>. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445 \u0432\u044b \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b Brython.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Brython<\/h4>\n<p><a class=\"anchor\" name=\"brython-core-components\" id=\"brython-core-components\"><\/a><\/p>\n<p>\u042f\u0434\u0440\u043e Brython \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <em>brython.js<\/em> \u0438\u043b\u0438 \u0432 <em>brython.min.js<\/em>, \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0432\u0438\u0436\u043a\u0430 Brython. \u041e\u0431\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p><strong>brython()<\/strong> \u2014 \u044d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f JavaScript, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d JavaScript. \u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043a\u043e\u0434 Python \u0431\u0435\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u042d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f JavaScript, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>__BRYTHON__<\/strong> \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 JavaScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Python. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Brython. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043a\u043e\u0434 Brython \u2014 \u043a\u0430\u043a JavaScript, \u0442\u0430\u043a \u0438 Python, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 <em>__BRYTHON__<\/em>. \u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u043e \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b<\/strong> \u2014 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html\" rel=\"noopener noreferrer nofollow\">\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 Python<\/a> \u0432 JavaScript. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/src\/py_int.js\" rel=\"noopener noreferrer nofollow\">py_int.js<\/a>, <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/src\/py_string.js\" rel=\"noopener noreferrer nofollow\">py_string.js<\/a> \u0438 <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/src\/py_dict.js\" rel=\"noopener noreferrer nofollow\">py_dicts.js<\/a> \u2014 \u044d\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#numeric-types-int-float-complex\" rel=\"noopener noreferrer nofollow\">int<\/a>, <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#text-sequence-type-str\" rel=\"noopener noreferrer nofollow\">str<\/a> \u0438 <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#mapping-types-dict\" rel=\"noopener noreferrer nofollow\">dict<\/a>.<\/p>\n<\/li>\n<li>\n<p><strong>browser<\/strong> \u2014 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/master\/www\/doc\/en\/browser.md\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0434\u0443\u043b\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b JavaScript, \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043d\u044b\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b DOM \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/brython.info\/static_doc\/en\/dom_api.html\" rel=\"noopener noreferrer nofollow\"><em>document<\/em><\/a> \u0438 \u043e\u043a\u043d\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/brython.info\/static_doc\/en\/jsobjects.html\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u044a\u0435\u043a\u0442\u0430 <em>window<\/em><\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0432 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435.<\/p>\n<h4>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Brython<\/h4>\n<p><a class=\"anchor\" name=\"brython-standard-library\" id=\"brython-standard-library\"><\/a><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0431\u0430\u0437\u043e\u0432\u043e\u043c Brython-\u0441\u043a\u0440\u0438\u043f\u0442\u0435 <em>brython.js<\/em> \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u043e \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0435\u043c\u0443 <em>brython_stdlib.js<\/em>.<\/p>\n<p><em>brython_stdlib.js<\/em> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python. \u041f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Brython \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python \u0432 JavaScript \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 <em>brython_stdlib.js<\/em>.<\/p>\n<p>Brython \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u044b\u043c \u043a <a href=\"https:\/\/www.python.org\/\" rel=\"noopener noreferrer nofollow\">CPython<\/a>, \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Python. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e CPython \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c\u0438 <a href=\"https:\/\/realpython.com\/cpython-source-code-guide\/\" rel=\"noopener noreferrer nofollow\">Your Guide to the CPython Source Code<\/a> \u0438 <a href=\"https:\/\/realpython.com\/products\/cpython-internals-book\/\" rel=\"noopener noreferrer nofollow\">CPython Internals<\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 Brython \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0438 \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>os.open()<\/em> \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0440\u0435\u0434\u0435 Brython:<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; import os &gt;&gt;&gt; os.unlink() Traceback (most recent call last):   File , line 1, in  NotImplementedError: posix.unlink is not implemented<\/code><\/pre>\n<p><a href=\"https:\/\/docs.python.org\/3\/library\/os.html#os.unlink\" rel=\"noopener noreferrer nofollow\"><em>os.unlink()<\/em><\/a> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u0441\u0440\u0435\u0434\u044b \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e, \u0430 <a href=\"https:\/\/wicg.github.io\/entries-api\/\" rel=\"noopener noreferrer nofollow\">API \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432<\/a> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0447\u0435\u0440\u043d\u043e\u0432\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c.<\/p>\n<p>Brython \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 Python. \u041e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <a href=\"https:\/\/realpython.com\/build-python-c-extension-module\/\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0434\u0443\u043b\u0438 Python, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 C<\/a>, \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043d\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 JavaScript. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/docs.python.org\/3\/library\/hashlib.html\" rel=\"noopener noreferrer nofollow\"><em>hashlib<\/em><\/a> \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/python\/cpython\/blob\/37834136d0afe51d274bfc79d8705514cbe73727\/Modules\/hashlib.h\" rel=\"noopener noreferrer nofollow\">C<\/a> \u0432 CPython \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/brython-dev\/brython\/blob\/02365fa0eb746fca7b044968335c9c954d7e55ff\/www\/src\/libs\/hashlib.js\" rel=\"noopener noreferrer nofollow\">JavaScript<\/a> \u0432 Brython. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e <a href=\"https:\/\/brython.info\/static_doc\/en\/stdlib.html\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 Brython<\/a>, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 CPython.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Python \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c <em>brython_stdlib.js<\/em> \u0438\u043b\u0438 <em>brython_stdlib.min.js<\/em>.<\/p>\n<h4>Brython \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438<\/h4>\n<p><a class=\"anchor\" name=\"brython-in-action\" id=\"brython-in-action\"><\/a><\/p>\n<p>\u041a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0432\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u0430\u0434\u0430\u0435\u0442\u0435\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043a\u0430\u043a Brython \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e JavaScript. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u043d\u0430 Python \u0432 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>\u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"#cdn-installation\" rel=\"noopener noreferrer nofollow\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 CDN<\/a> \u0432\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"xml\">&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;script             src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/brython\/3.13.0\/brython.js\"&gt;         &lt;\/script&gt;     &lt;\/head&gt;     &lt;body onload=\"brython()\"&gt;         &lt;script type=\"text\/python\"&gt;             import browser             browser.alert(\"Hello Real Python!\")         &lt;\/script&gt;     &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b <em>brython()<\/em> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u0434 Python, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439\u0441\u044f \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 <em>&lt;script type=&#187;text\/python&#187;&gt;<\/em><\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 Python-\u043a\u043e\u0434 \u0432 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 JavaScript-\u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 JavaScript \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/eval\" rel=\"noopener noreferrer nofollow\"><em>eval()<\/em><\/a><\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434 Python \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 HTML-\u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"xml\">&lt;script type=\"text\/python\"&gt;     import browser     browser.alert(\"Hello Real Python!\") &lt;\/script&gt;<\/code><\/pre>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u0434 Python \u0438\u0437 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"xml\">import browser browser.alert(\"Hello Real Python!\")<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u0439\u043b Python \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">import browser browser.alert(\"Hello Real Python!\")<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 Python \u0438 \u043a\u043e\u0434\u0430 HTML \u2014 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 HTML JavaScript, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 HTML Python.<\/p>\n<h4>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Brython<\/h4>\n<p><a class=\"anchor\" name=\"brythons-internals\" id=\"brythons-internals\"><\/a><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 Python \u0432 JavaScript. \u0415\u0441\u043b\u0438 \u0432\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u044d\u0442\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2014 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Brython, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 <a href=\"https:\/\/brython.info\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 Brython<\/a>.<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>Cmd+Alt+I<\/code> \u043d\u0430 Mac \u0438\u043b\u0438 <code>Ctrl+Shift+I<\/code> \u043d\u0430 Windows \u0438 Linux.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 JavaScript <a href=\"https:\/\/en.wikipedia.org\/wiki\/Read%E2%80%93eval%E2%80%93print_loop\" rel=\"noopener noreferrer nofollow\">REPL<\/a> \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"javascript\">&gt; eval(__BRYTHON__.python_to_js(\"import browser; browser.console.log('Hello Brython!')\"));<\/code><\/pre>\n<p><em>python_to_js()<\/em> \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 Python \u0432 JavaScript, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 JavaScript \u0432 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041e\u0446\u0435\u043d\u043a\u0430 Python \u0432 JavaScript<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 <em>eval()<\/em> \u043a \u043a\u043e\u0434\u0443 Brython \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 <em>&#171;Hello Brython!&#187;<\/em>. <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Functions\" rel=\"noopener noreferrer nofollow\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f JavaScript<\/a> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>undefined<\/em>, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 JavaScript.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Brython \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 <em>__BRYTHON__<\/em> \u043c\u043e\u0434\u0443\u043b\u0435 JavaScript. \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a Brython \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438. \u0417\u043d\u0430\u043d\u0438\u0435 <em>__BRYTHON__<\/em> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u0434 Brython \u0438 \u0434\u0430\u0436\u0435 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u043a\u043b\u0430\u0434 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u043c\u0435\u0440\u0435 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044f \u043e\u043f\u044b\u0442\u0430. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 JavaScript <em>__BRYTHON__<\/em> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 JavaScript, \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u0438 JavaScript \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Brython \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/h3>\n<p><a class=\"anchor\" name=\"using-brython-in-the-browser\" id=\"using-brython-in-the-browser\"><\/a><\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u043d\u0438\u0439 \u043e Brython, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438. \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Base64\" rel=\"noopener noreferrer nofollow\">Base64<\/a>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0441 API DOM \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 JavaScript.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435, \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 <a href=\"https:\/\/github.com\/realpython\/materials\/tree\/master\/brython\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443<\/a>.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c DOM \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python \u0438 HTML.<\/p>\n<h4>API DOM \u0432 Brython<\/h4>\n<p><a class=\"anchor\" name=\"the-dom-api-in-brython\" id=\"the-dom-api-in-brython\"><\/a><\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f\u043c\u0438 DOM, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0432 Brython, \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 <a href=\"https:\/\/docs.python.org\/3\/library\/base64.html\" rel=\"noopener noreferrer nofollow\">Base64<\/a>. \u0413\u043e\u0442\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u044b Base64<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 HTML-\u0444\u0430\u0439\u043b \u0438 \u043d\u0430\u0437\u043e\u0432\u0438\u0442\u0435 \u0435\u0433\u043e <em>index.html<\/em>:<\/p>\n<pre><code class=\"xml\">&lt;!-- index.html --&gt; &lt;!DOCTYPE html &gt; &lt;html&gt;   &lt;head&gt;     &lt;meta charset=\"utf-8\"\/&gt;     &lt;link rel=\"stylesheet\"           href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/pure\/3.0.0\/pure-min.css\" \/&gt;     &lt;script         src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/brython\/3.13.0\/brython.min.js\"&gt;     &lt;\/script&gt;     &lt;script         src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/brython\/3.13.0\/brython_stdlib.min.js\"&gt;     &lt;\/script&gt;     &lt;script src=\"main.py\" type=\"text\/python\" defer&gt;&lt;\/script&gt;     &lt;style&gt;body { padding: 30px; }&lt;\/style&gt;   &lt;\/head&gt;   &lt;body onload=\"brython()\"&gt;     &lt;form class=\"pure-form\" onsubmit=\"return false;\"&gt;       &lt;fieldset&gt;         &lt;legend&gt;Base64 Calculator&lt;\/legend&gt;         &lt;input type=\"text\" id=\"text-src\" placeholder=\"Text to Encode\" \/&gt;         &lt;button           type=\"submit\" id=\"submit\"           class=\"pure-button pure-button-primary\"           autocomplete=\"off\"&gt;Ok&lt;\/button&gt;         &lt;button id=\"clear-btn\" class=\"pure-button\"&gt;Clear&lt;\/button&gt;       &lt;\/fieldset&gt;     &lt;\/form&gt;     &lt;div id=\"b64-display\"&gt;&lt;\/div&gt;   &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 HTML-\u043a\u043e\u0434 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u043a\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e Python:<\/p>\n<ul>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 7<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 <a href=\"https:\/\/purecss.io\/\" rel=\"noopener noreferrer nofollow\">PureCSS<\/a> \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0438\u043b\u044f HTML \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u042d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b Brython.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 9<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0434\u0432\u0438\u0436\u043a\u0430 Brython.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 12<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Brython.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 14<\/strong> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 <em>main.py<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/script\" rel=\"noopener noreferrer nofollow\">defer<\/a>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043e\u0446\u0435\u043d\u043a\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e Brython \u0438 \u043b\u044e\u0431\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b Python \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c <em>brython()<\/em>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 21<\/strong> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0435 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/input\" rel=\"noopener noreferrer nofollow\"><em>input<\/em><\/a>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0438 22\u201325<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/button\" rel=\"noopener noreferrer nofollow\"><em>button<\/em><\/a>, \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 <em>main.py<\/em> \u043d\u0438\u0436\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 26<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 <em>button<\/em> \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0432 <em>main.py<\/em> \u043d\u0438\u0436\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0412 <strong>\u0441\u0442\u0440\u043e\u043a\u0435 29<\/strong> \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/div\" rel=\"noopener noreferrer nofollow\"><em>div<\/em><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u043c \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 Python <em>main.py<\/em> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">from browser import document, prompt, html, alert import base64  b64_map = {}  def base64_compute(_):     value = document[\"text-src\"].value     if not value:<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-444899","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444899","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=444899"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444899\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}