{"id":294355,"date":"2019-09-06T15:00:32","date_gmt":"2019-09-06T15:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=294355"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=294355","title":{"rendered":"C\/C++ \u0438\u0437 Python"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" alt=\"main\" width=\"500\" src=\"https:\/\/habrastorage.org\/webt\/up\/e1\/2v\/upe12vokda_crnab9gfx9bv-qyu.jpeg\"><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u043e \u0442\u043e \u043a\u0430\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c Python \u0438\u0437 C \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c C\/C++ \u0438\u0437 Python. \u0420\u0430\u0437 \u043d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c, \u0442\u043e \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u0432\u0441\u044e \u0442\u0435\u043c\u0443 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u043d\u0438 \u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u0442\u043e\u0436\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"c\">C<\/h2>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, python \u0443\u043c\u0435\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c C \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<p>  <\/p>\n<p>test.c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include \"test.h\"  int a = 5; double b = 5.12345; char c = 'X';  int  func_ret_int(int val) {      printf(\"get func_ret_int: %d\\n\", val);     return val; }   double  func_ret_double(double val) {      printf(\"get func_ret_double: %f\\n\", val);     return val; }   char * func_ret_str(char *val) {      printf(\"get func_ret_str: %s\\n\", val);     return val; }   char func_many_args(int val1, double val2, char val3, short val4) {      printf(\"get func_many_args: int - %d, double - %f, char - %c, short - %d\\n\", val1, val2, val3, val4);     return val3; } <\/code><\/pre>\n<p>  <\/p>\n<p>test.h:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#ifndef _TEST_H_ #define _TEST_H_  #ifdef  __cplusplus extern \"C\" { #endif  #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;unistd.h&gt;  int func_ret_int(int val); double func_ret_double(double val); char *func_ret_str(char *val);  #ifdef  __cplusplus } #endif  #endif  \/* _TEST_H_ *\/<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c :<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">gcc -fPIC -shared -o libtest.so test.c<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u0433\u043e\u0442\u043e\u0432 \u043a \u0431\u043e\u044e.<br \/>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a python. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>main.py:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/python3 #-*- coding: utf-8 -*-  import ctypes   # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 test = ctypes.CDLL('.\/objs\/libtest.so')  ## # \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 ##  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 int test.func_ret_int.restype = ctypes.c_int # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 int test.func_ret_int.argtypes = [ctypes.c_int, ]  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 double test.func_ret_double.restype = ctypes.c_double # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 double test.func_ret_double.argtypes = [ctypes.c_double]  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 char * test.func_ret_str.restype = ctypes.c_char_p # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 char * test.func_ret_str.argtypes = [ctypes.POINTER(ctypes.c_char), ]  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 char test.func_many_args.restype = ctypes.c_char # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 char * test.func_many_args.argtypes = [ctypes.c_int, ctypes.c_double, ctypes.c_char, ctypes.c_short]  print('ret func_ret_int: ', test.func_ret_int(101)) print('ret func_ret_double: ', test.func_ret_double(12.123456789))  # \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0431\u0430\u0439\u0442\u043e\u0432, \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442\u043e\u0432 \u043a \u0441\u0442\u0440\u043e\u043a\u0435. print('ret func_ret_str: ', test.func_ret_str('Hello!'.encode('utf-8')).decode(\"utf-8\") )  print('ret func_many_args: ', test.func_many_args(15, 18.1617, 'X'.encode('utf-8'), 32000).decode(\"utf-8\"))  print()  ## # \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 ##  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 int a = ctypes.c_int.in_dll(test, \"a\") print('ret a: ', a.value)  # \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. a.value = 22 a = ctypes.c_int.in_dll(test, \"a\") print('ret a: ', a.value)  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 double b = ctypes.c_double.in_dll(test, \"b\") print('ret b: ', b.value)  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 char c = ctypes.c_char.in_dll(test, \"c\") print('ret c: ', c.value.decode(\"utf-8\"))<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0445 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"#https:\/\/docs.python.org\/3\/library\/ctypes.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> python.<\/p>\n<p>  <\/p>\n<h2 id=\"c-1\">C++<\/h2>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442.\u043a. <strong>ctypes<\/strong> \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 <strong>C<\/strong> \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. \u042d\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0441 \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043f\u0440\u043e\u0441\u0442\u043e C \u043e\u0431\u0432\u044f\u0436\u0435\u043c \u043a\u043e\u0434 C++.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 C++ \u0438 \u043e\u0431\u0432\u044f\u0437\u043a\u0430 \u043d\u0430 C:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include \"test.hpp\"  \/*  * \u041c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430  *\/ std::string test::ret_str(std::string val) {     std::cout &lt;&lt; \"get ret_str: \" &lt;&lt; val &lt;&lt; std::endl;     return val; }  int test::ret_int(int val) {     std::cout &lt;&lt; \"get ret_int: \" &lt;&lt; val &lt;&lt; std::endl;     return val; }  double test::ret_double(double val) {     std::cout &lt;&lt; \"get ret_double: \" &lt;&lt; val &lt;&lt; std::endl;     return val; }  \/*  * \u041e\u0431\u0432\u044f\u0437\u043a\u0430 C \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 C++  *\/  test *test_new() {     return new test(); }  char *test_ret_str(test *test, char *val) {     std::string str = test-&gt;ret_str(std::string(val));     char *ret = new char[str.length() + 1];      strcpy(ret, str.c_str());      return ret; }  int test_ret_int(test *test, int val) {     return test-&gt;ret_int(val); }  double test_ret_double(test *test, double val) {     return test-&gt;ret_double(val); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043d\u044e\u0430\u043d\u0441, \u043e\u0431\u0432\u044f\u0437\u043a\u0443 \u043d\u0430\u0434\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043a\u0430\u043a <strong>extern C<\/strong>. \u0427\u0442\u043e \u0431\u044b ++ \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u043b \u0438\u043c\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0431\u0432\u044f\u0437\u043a\u0438. \u0415\u0441\u043b\u0438 \u043e\u043d \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442, \u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0447\u0435\u0440\u0435\u0437 ctypes \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438.<br \/>  test.hpp:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;string.h&gt;  class test { public:     int a = 5;     double b = 5.12345;     char c = 'X';      std::string ret_str(std::string val);     int ret_int(int val);     double ret_double(double val); };  #ifdef __cplusplus extern \"C\" { #endif      test *test_new();     char *test_ret_str(test *test, char *val);     int test_ret_int(test *test, int val);     double test_ret_double(test *test, double val);  #ifdef __cplusplus } #endif<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<br \/>  g++ -fPIC -shared -o libtestpp.so test.cpp <\/p>\n<p>  <\/p>\n<p>\u0421 python \u0432\u0441\u0435 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 testpp = ctypes.CDLL('.\/objs\/libtestpp.so')  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c testpp.test_new.restype = ctypes.c_void_p  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 char * testpp.test_ret_str.restype = ctypes.c_char_p # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 void * \u0438 char * testpp.test_ret_str.argtypes = [ctypes.c_void_p, ctypes.c_char_p]  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 int testpp.test_ret_int.restype = ctypes.c_int # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 void * \u0438 int testpp.test_ret_int.argtypes = [ctypes.c_void_p, ctypes.c_int]  # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 double testpp.test_ret_double.restype = ctypes.c_double # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 void * \u0438 double testpp.test_ret_double.argtypes = [ctypes.c_void_p, ctypes.c_double]  test = testpp.test_new() print('ret test_ret_str: ', testpp.test_ret_str(test, 'Hello!'.encode('utf-8')).decode(\"utf-8\")) print('ret test_ret_int: ', testpp.test_ret_int(test, 123)) print('ret test_ret_double: ', testpp.test_ret_double(test, 9.87654321))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0431\u044b \u0437\u0434\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435 )<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<p>  <\/p>\n<h2 id=\"ssylki\">\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/dvjdjvu\/c-cpp_from_python\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432<\/a><br \/>  \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f <a href=\"https:\/\/habr.com\/ru\/post\/466181\/\">Python \u0438\u0437 C<\/a><\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/466499\/\"> https:\/\/habr.com\/ru\/post\/466499\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" alt=\"main\" width=\"500\" src=\"https:\/\/habrastorage.org\/webt\/up\/e1\/2v\/upe12vokda_crnab9gfx9bv-qyu.jpeg\"><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u043e \u0442\u043e \u043a\u0430\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c Python \u0438\u0437 C \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c C\/C++ \u0438\u0437 Python. \u0420\u0430\u0437 \u043d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c, \u0442\u043e \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u0432\u0441\u044e \u0442\u0435\u043c\u0443 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u043d\u0438 \u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u0442\u043e\u0436\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-294355","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294355","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=294355"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294355\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}