  Python
 


       Python     .     Python;       ;     Python; ,     ;           .       ,       .                  Git.           ,        -.       ,    ,           .





 

  Python





  


Python     1990-      Stichting Mathematich Centrum        ABC.

 1995       Python       ,  ,       .

  2000       Python   BeOpen.com,    BeOpen PythonLabs.       PythonLabs   Digital Creations ( Zope Corporation).  2001       Python (PSF),  ,      ,   Python. Zope Corporation  - PSF.

  Python    .   ,   (  )  Python     GPL (GNU General Public License;     ,     GNU  1988 .,         ).

   Python?        Python,         BBC     1970- .   ,    ,     ,      Python.

Python   - ( ),   ,  ,      .

Python     -,        ,   ,    .   Python      ,    .

Python           .

Python     (Windows, Mac, Linux, Raspberry Pi  . .)  Python   ,    .  Python        ,      .

Python      ,      ,         .

 Python         ;     ,   .          .

Python    ,   ,         .  ,      .

 Python   , -   .

    Python  Python 3,  Python 2,     ,   , -  .

  Python     ,    ,   Thonny, Pycharm, Netbeans  Eclipse,         Python,    Jupyter Notebook.

  Python    https://www.python.org/downloads/   .

Jupyter Notebook    - ,          -.  Jupyter Notebook       ,     ,           .

 , ,  ,  Jupyter Notebook    (Notebook Dashboard),           .

      ,            .              .        Python         .

  ,      Python       .  IPython            Python,       ,  ,  ,  ,    .

  IPython      ,      Python,        ,     ,  ,  ,     ,   ,          .          ,  -  :   ,   ,     ,     ,     ,    ,   ,      .

  IPython       ,         .

     IPython;          ,     .  2004        ,  -      IPython.       Notebooks  IPython,   2011      ,     IPython Notebook   .        Jupyter        .

    , IPython Notebook  , ,      , ,      ,     ,      .  2014  IPython Notebook   Project Jupyter        100 ,       ,     .

          ,   Project Jupyter,       ,     ,            ,        ,    COVID-19.

   -   ,     Jupyter    JupyterLab,        pip   .

pip install jupyterlab

 pip     ()  Python.




  


        ,    ,  .    ,     ,      ,      ,   ,   ,      .

    ,    .          ,      . ,         ,       .         ,       .        ,   ,   ,  ,    ,  ,   .

         Python.      ,     Python  .   ,    ,    ,    ,   ,    .

       .   ,   Python,       ,     ,    .

    ,      .    ,   ,          . ,         ,      .

,     ,   . ,    ,    ,   ,   .             .

     .       .         ?       .       .

 ,         ,      .  ,     ,       .

      ,  Python,    ,    .     Python,     Python      .

     ,       Python,     ,       .

      ,         .  -            ?      ,        ,     .       .

       . ,  , ,        .      ,       .    ,           ,      .        ,    ,      ,   .  ,   ,        ,    .

       .     , , , ,     . ,        ,      ,  ,    .

,     ,       .       . ,        ,      .                   ,    .   ,   ,        ,   ?  ,   ,               .        ,     ,       .    -     ,  ,     .             ,     ,     -.

   ,          .    ,   ,         ,   .

  IT-,        .         ,  ,   ,           ,   .

    IT,  ,   ,             .         .     ,        ,      .

,         ,     .  ,  ,          .

   .              ,        .           ,        .   ,     ,          ?         ,      .    ,   ?   ,       .          ,     ,      .        .      ?

    .   ,    ,        .        ,    ,      .  ,       .  ,  ,         ,    . , ?     . ,       .      ,         .       .     ,          . ?            .

     ,      ,       .       .   ,      ,    .

      Python,            .  ,     ,      Python?   Python   . -,   Python      .  ,  Python    ,    ,   ,     .








   .            , , ,  ,    .      ,         .

            .     Python  ,    ,   python3 (  python  Windows),   ,  exit()   Ctrl-D.

   ,     - Python   ,   .        .   ,   ,        .

         -   .  ,    .

https://www.python.org/shell/

https://www.onlinegdb.com/online_python_interpreter

https://repl.it/languages/python3

https://www.tutorialspoint.com/execute_python3_online.php

https://rextester.com/l/python3_online_compiler

https://trinket.io/python3

,     Python  ?    ,     . ,   ,         ?  ,      Python,  Python   ,   ,    ,        .

Python      ,      ,     .   Python     .      Python. Python    IT-,          . Python  .           1991 .      ,    .  ,         ,    .  2000    Python 2.  2008    Python 3.

    Python                 .      Python  .        .     ,   Python         .    Python   ,    ,  ,   -     . Python    .     ,   ,      .   Python      ,    -,    -.  ,      ,       .  , Python        ,   Windows, Linux  Mac OS.

   Python,  ,          .             -.         .   ,  .      ,      .   ,    ,   PowerShell,   Windows,  Bash,   Linux.        .      ,   Python,   Perl  Ruby,         . JavaScript,          -,            .      .     ,   ,   C, C++, Java  Go.         , , ,       ,     .      .      Python.

          ,  ,  ,     ,   ,   .  ,      Python,       ,           .   ,       ,    ,   ,       .      ,   .     ,    -     .         .    ,      ,      ,     .      ,  .

         ,    ,    Hello, World      : Python, Bash  PowerShell.








 ,        Hello World.   ,     .    -     .   Python  print,  Bash  echo,   PowerShell  write host.   ,     -    10.     Python  ,   10, Bash       1  10. PowerShell       ,      ,    1    10.

 ,     ,     .      .         Python.     Python,         .

,           ,  .     Python,      .     ,       -,  Hello, World   ,   .








  ,   .  ,  print    Python,     ,    .    Hello, World  print     Python.  ,       ,    ,     ,   ,  .

,      ?     ,    .       ,       .      ,    .            .    if, while  for.         .

   ,    ,   Python,   .    ,   ,         ,     ,     .

 ,  ,  Hello, World    .       ,    ,   ,       .    ,     ,   .

    :   ,        ?   "Hello, World"          70- ,                "  C".

   "Hello, World"     ,       ,       ,    .

 ,    ,         .        ,    ,    , ,  "Hello, World".       . ,  -    ,     ,    .     ,        ,   .

        ,      ,        .    ,      -.          ,            .

   ,          ?  ,  ,     ,     ,        .

       ,   - .                 .  ,   .








      ,    ,    ,   ,     .         ,       ,       .

    ,      Python.   Python  .








  - . 4+5  , 9*7  63, -1/4  -0,25.

        .   1/3.   ,     ,       . ,   -,   .      ,    .

   - . ,    2050  5,   32,      .      ,      .

    Python   ,     n . , ,   ,   2^10.  Python   ,     .

   ,      , .      ,  ,     .      Python   ?   ,      .  IT-   ,    .    ,       ,    ,    ,     ,       .       ,          .   ,     .

 Python         ,     , ,      .

,      .

     , ,     .

    ,     .       ,      Python.     ,   ,  ,    .

 ,        .       .     , ,   . VS Code, Jupyter Notebooks  CoLab      .

   IDE   ,   .      IDE   ,       .  IDE        ,   .         .           . IDE    .  -    ,      ,    ,   ,       .

IDE    ,       . IDE    ,        .  IDE    . IDE     ,      .   , ,       .      ,       .

IDLE   IDE,    Python .








  IDE  ,       . ,      ,     ,    IDE.

 Windows   .     cmd.     cmd      .    .

 Windows     Python.     Python  Windows.   Windows (64- )  (32- ).      .       .     .       python.exe.     Python   .        Python   .

   Python,   .     Python.

python --version

     Python  .   python,    .

Python IDLE    Python  Windows  MacOS. Python IDLE       ,         Python. IDLE   ,      .

   IDLE,      .     Python.       .








     .  File ? Open ? New File   .      Python.    Python  ,  File ? Save As.    Python .  Save.    Python   ,    Run ? Run Module.








   ,        .

  Jupyter Lab  Jupyter Notebooks  ,     Python. Jupyter Lab  Jupyter Notebooks         Project Jupyter,    .

      Jupyter  jupyter.org. Jupyter Lab   -,   Jupyter Notebooks  ,     Python. Jupyter Lab  -,      .  Jupyter Notebooks    -  Jupyter Lab     . Jupyter Notebook   ,    .       Python   Jupyter Notebooks  ,   ,   .        ,   ,             .








      Jupyter Notebooks    .        jupyter.org.       jupyter.org,   Try.   Jupyter Lab.              Python  .   ,         Python.

    Jupyter Lab  Jupyter Notebooks    .        pip     Python.   Jupyter Lab,   pip install jupyterlab   .      ,   jupyter-lab.

   Jupyter,   pip install notebook   .          jupyter notebook.

 Colab   Jupyter Notebooks,   Google Colaboratory.  Colab       Python.

Colab  -,       Python   Google .         .     colab.sandbox.google.com     Google  Colab,  . Colab   ,   Python.   Colab   ,   .          ,      .

   Python     pip   .  Colab      .








  ,   Colab.   Google Colab.  ,      colab.sandbox.google.com.      New Notebook.       Python.

     ,    .       ,   Run    .       .     Untitled.ipynb  -  Name.ipynb.       .

   Colab ,         Google .    ,       Google ,  Colab Notebooks         Colab Notebooks.     ,   .

VS Code        ,       .    Jupyter Notebooks  Colab,      . VS Code      IntelliSense,         . VS Code   ,      .            Python.

  VS Code  Python,    Python 3, VS Code   VS Code Python.

   VS Code    Windows, Mac  Linux.

 VS Code    codevisualstudio.com/download.    Python  VS Code   .     VS Code,  Ctrl+Shift+X.       VS Code    VS Code.    Python,   ,   Install.          Python.    ,  Create Python file.    .        print("hello world")    .   Run,   .       .    Python    Save.   ,     .

     IDE. PyCharm    IDE    Python.  IDE    ,     ,     .       ,   ,       .

PyCharm          ,      .     ,     ,        .       IDE,         . , PyCharm     ,   ,    .

 , PyCharm   ,     IDE.     ,          ,   ,        . PyCharm     .

PyDev   IDE        Python,   Eclipse. PyDev      ,   , ,   .           ,     . PyDev     Eclipse,  ,       Eclipse,    ,     .

PyDev   IDE     .  ,     Python,      . PyDev      ,     ,     .

Notepad++           Microsoft Windows.     ,  Python. Notepad++       .        .     ,       ,    , ,      .       ,        . Notepad++     ,       ,        .

Notepad++      ,    Microsoft Windows.    ,   .              .

          IDE   , -   .  ,    IDE   ,     . , Gemini Code Assist       ,    IDE,   Visual Studio Code  JetBrains.    ,        ,  ,      ,     ,  ,    .

        -,       ,      , ,      . ,         ,   .      ,  ,         .        ,         .




  


Python     .  ,           .

     Jupyter Notebooks.       

jupyter lab








     .








  File        .

          Python    Run   .








   ,      .           ,        .

  ,        .   Python    ,     .      ,         .








    100.   100   . ,        ,     .








    .     ,      ,    .           print.      .

     ,      .        .   ,  ,       .     ,     .








        .       ,     ,  -       .

        ,       F-      Python (https://docs.python.org/3/tutorial/inputoutput.html). F-     f      ,  ,     .








 ,        .      ,    .       .     .

        ,     .

,   .      ,         Python.








    ,     ,     .   , ?

        ,     ,    ,      ,     .

       , ,      Python.

       ,      ,  .








,         .           +.








,    ,     type. ,   type,     ,     .        .

15   .   Python   int.

        .

   14      7.   ,        2.

      ,    .       .

      ,         ,     .        .        .








,       ,  ,     14    7    2.0   .       .

       true  false.    T    F      .

     bool  1  0   ,  Python        .

, ,     None,     Python.  ,       None.     None ,           ,    .

  ,  ,     Python,  .        .     - ,        , ,    ,  .         ,   Python.

  , ,  ,       , , 1,     ,    . ,  ,    , , 2,5.  ,    ,     . ,         .

     .        .     ,      .          ,    ,  ,   .   .      ,  , ,     .

   ,         ,       .     , ,    ,      ,   .








         ,     -,  TypeError.     ,   ,        int   str,         .  "  "    ,        7   "8",      .

   7  8   ,   7  a  ,  7  a    . ,          ,    . ,        ,         .   -    100%   ,      , Python      .








    `type`,     .       ,  - ,    ,    .

 ,  ,          ,      .   ,            ?








Python     ,    ?               ? ,  ,           7      7.   Python   ,   ,       .      .

       .      ,     ,   Python    .         .








      .        ,      .

 ,        ?   ? , ,     .  Python            ,    .








 ,   .        ,        .       str,     .             .




 


    ,   ,   .  Python    .    ,   -,     - .             .








    .    10  ,      True. True   ,   ,    (Boolean).        : True  False.  ,    -  Python,    .

      ,       .       ,      .     cat    dog,      False.

      .      ,    .      ,     .








  ,          .   ,  ,        ?   , ,    ,   1.    .   ,  Python  ,  ,   ,  .








    ?        ,    1   1       .   ,     .

    ,  Python     .            .  Python     ,   .








    ,      .    ,         . Ƹ   ,      .  ,    ,    ,      .








    ,     ,       ,    ,    .








,     ,    .   ,   .   ,   .

  ,       .

      ,    ,   . , ,        . ,   ,    -,      ,   .    ,      .  , , ,  .

          ,    .

,    ,    if.








if     Python,      ,           .

,   ,   ,    True.    ,   :  .

          ,   ,            Python.     True,     .

 ,    ?   ,   Python   False,    ,       .








 ,    ,   ,    False,    True,    .

   ,   groceries ,        .

     invites  ,     .

           Python,     Python  ,    ,     .








,   ,    ,    ,   False,        True.








    ,       True  False   if.

 if     ,     ,      .








    else,     

    ,      .    ,   ,   ,    .    ,     ,   ,   ,   .

   ,    else.     else,    ,     else.  ,    .     ,         ,    .    ,  ,     .  ,         ,    ,       .








 else    if         ,    ,       - .

  ,   if   False,      else.








     elif ( ).

 elif ,      True  False   else.    else,    ,   ,      .








     ,     .   name   None.       not.  ,       .

 ,    - :   ,  .








        elif.      ,      .















     ,       .

      True,    .        not.         False  True     .







   ,            .    ,     .           1000 ,       ,   ,  , ,    .  -   - 1000  ?    ,     .

                .     , ,       ,         ,     . ,   ,      ,    ,        ,            .

       :  while,  for  .       ,     ,        .

     while.  while           .      if.   ,       ,     .








   .    ,   ?    .

      x  .     ,     .       while.      : x    .   ,  x  0,      ,       .

       ,  ,     while.     .      ,      x.       x.   ,           x.      x   1  0.   ,         .       ,       while.

      ,     .        x  .  x  2.        ,     .

     ,  x     5.     ,  ,     . ,        x.

    ,    while.    ,     .    ,         .  IT-  while    .    ,     ,   , , ,   ,     .            ,     .

     while  .








   ,    ?           x.        1.      while,  ,     x  n,  .    ,      while.

,    5     .     x   1,    1    5  .      .      ,     .     x  1,   .      ,  : x + = 1      x = x + 1.       ,        .

    ,      ,  ,    n.      ,   x  6.








      :        .   ,      ,      while.

,    ,   .        ,   ,    .    getusername,      ,   valid username,     .         .

     while     ,       .

 ,  ,   while,      . ,           . ,    while,     ,      and, or  not.      ,    .

    ,           .         IT        ,   .   ,       ,      .

           .     ,  .     ,     .








  ,     ,    Python,  ,     .       ,    ,      ,  ,  .      ,  ,    ,   ,     .    .        .








   ,     ,      .         .   ,     ,       ,       .       .

   .     ?       x  1  sum  0,      ,  x    10,    .  ,     sum       1  10,  x  10.

        ,       1  10. ,   ,  ,    product,    x. , x -  10.  , ,     while, x   10   .   while     ,      .

       ,   Python   .     ,   -      ,  ,  ,     .       x   1    .

,  :  ,    , ,     ,   ,    .

,   ,   while  ,  ,   .   while  ,    .    ,     ,         ,       .








  .      .         x.   ,  x   ?    0/2  ,    .         ,   x  ,     ,     .

  ,     ,   ,    .








     ,  x     .       while   if.     while   ,  x   .








          ,   ,    .  ,          x,        .

,           ,    .    ,     .   ,     ,  ,      ,  ,      .

    ,    .    ,     ,     -  .     ping  Linux  macOS,  ping-t  Windows,      .           ,       ,   Ctrl+C.

       ,   ,          ,      .  ,       ,   .    ping,      Ctrl+C.            ,      ,     .








      ,    .  Python     brake,    ,      .          ,      ,      .

        while? -,     ,  -, ,       .

    for.  for   .








    for     .  ,      ,    .      .     for,    .     ,      while   if.

         in.  ,    for  in   .        ,    .        ,     range.    ,        range.

-,  Python             . -,         .    x    0, 1, 2, 3  4.








         while.    ,    ,   ,      .   ,    for   ,            ,      .       for,    .     ,         .

,     for,     ,    . ,      ,       .








    .      , sum  length,       for.   for       ,      ,       ,  ,    .  ,     ,      .

  ,    ,     ,   , ,   ,   .  IT-,     for    . ,       ,   ,       .

   ,     for,     while,    .   for,    ,    .   while,        ,    .  ,    ,       for,     while,   ,    .








    range   ,     ,   .        .     range      ,   .   ,      .          1  9.       ,    .      ,      .  ,          .  ,   ,     ,       .








   .     ,          ,        .      for,        100   10.  ,    101      100.   ,        ,     100   .

  for          ,   .

  ,  ,     .

 -   ?   ,    ,      ,   ,     .   0  6.

   ,             .  ,  2,3   ,    3,2,       .

 ,     ,       .     ,    ,        0  6 .        for.

   ,    ?      1,0,        0,1.             1  6 .

    ,      ,  ,   .

    ,      ,   .  ,      for.








,      Python.

      ,     print.    end. ,     print        ,   ,       .

  ,   print  -     ,    end,     .

 ,    for               left.

   ,        ,   ,           ,    ,      .








   . ,         .     ,        ,  ,    .      ,  .     ,         .

      ,          ,      .  ,    ,        .

    ,   ?       ,  ,       ,   .

 ,        .      ,             . ?     ,     ,         .

,    ,       10 000 .       ,      ,   10 000,   10 .  ,     ,       10 000 .  ,           , ,  ,  10 ,     .     10 000   10 ,   100 000 .   27 .

    ,     .    ,  for  .       .








   ,    x   25  x.         25.  Python   ,  ,      .     ,    ,    .      0  25,     range.








     ,   25   ,     ,   ,       .

,   ,        ,    .    ,        for ,    ,    . ,    ,       ,    ,      ,         .           .







             .  -   ?     .      .    ,    ,  ,       ,   .

     ,     .  ,    ,  ,    ,   .         ,     ,   ,    .    .

       . ,        ,    .   ,      .   ,   ,     ,    ,     .         ,    ?         ,   ,         ,   ,         .     ,     .        ,        ,      .  ,    ,         ,   ,     ,     ,   .

     ?              .            ,      .     .

                .








    ,  ,    .    ,  .        ,   ,  n  2,      1.

      ,        n-1.    ,    .  ,   ,       ,     .   ,    1,         ,           .

      ,         .








    print,   ,   .   ,      ,     .        ,   n,      .

,   ,     ,      for  while?  ,            .   , ,      ,    .        ,        .

      .     ,     IT-,   .

,    ,          ,       .     ,      ,       ,   .      .      ,  .        .            .                  .

 ,     ,    ,     ,   ,   ,   .

         ,   for  while.

    ,   ,   ,     ,     .          ,   Active Directory  LDAP.

,         ,      ,    ,       ,    .           .

     ,    ,         .        ,      ,      ,    .

 ,         .  Python       1000 ,     .     ,     ,      ,        .








         ,  n  1000,    1000.  ?   ,        . ,         ,      ,       ,    1000  .




 


 ,     Python.








  ,  Python          .

     ,     14  0,      ,      .








     .        ,    .       ,   ,   .      .         ,        ,    raise.















     .

  ?   try      ,    14  0,       ZeroDivisionError.

          except.      ,  ,   ,    ZeroDivisionError,    ,      except.

      .   ,        Exception.        .  ,     ,   ,   ,    Python.

   ,             .        .      ,    ,   .   ,    .       .








         .     ZeroDivisionError   TypeError (  ).  ,    ,       ,     .

     ,  .       ,         ZeroDivisionError  TypeError.








,       .           as    .         .







         ,          .

-,  .       Python,      .    ,       . ,     , ,   .       , Python      , ,       .








    ,   ,    ,   .              , ,  .

        ,        .

     ,     len.  len    ,   .

        .     ,  ,   ,      .   ,     ,    ,   ,   .

  ,         . ,   ,     ,      ,     .        ,       .

     ,  ,       .  ,          ? ,     ,     ,       ,      ,       .








      ,   .            ,       .

      ,      ,   .   ?   ,  Python     ,    ,      range.

,     ,       . ,     ,   ,      ?      ,  .        ,     .

        ,    , ,      .         .








 ,       ,   ,  ?   ,   .

          ,    .








    ,        .     ,      ,    .   ,        .

,        ,   ,   ,   range.    ,     ,   .        1,   ,     ,   .








          .    ,         ,      .            .     .          ,    .

,  ,        .  ,     ? ,        ,     .  ,      ,       ,       .








 ,  ,     .     ,      .  ,       ,     Python .    ,        .








.   .    ,   message    ?  .        .








    `message`   .     ,     .        .

 ,      ,    ,    ?

          .








   ,    .        .     ,   ,    ,     ,    .

 index      . ,   ,    .

    ?   ,     s,     .  ,   index    ,   .

 ,      ?  index    ,    ,       .

 ,     ,   ?








 .      in,  ,     .      in    for.       .   ,     ,  .

            ,       ,                .        ,  String        .








        , ,          .        .








,   ,      .  ,         ?    .        .








            strip.       .      ,      .    strip    .  ,  strip    ,        ,      ,  .

     : L strip  R strip,        ,     .






















      .

 count   ,      .

 ends ,     .

 is numeric ,      .

 ,     ,  ,     int      .








  ,    ,   .  join     .    join,     ,     .








,        .  split              .           , ,    .

     ,         ,   ,    str(),

    ,      .  ,    ,   ,      ,  .

    ,   format.    .








       : name  number.   ,   ,      ,  ,     .         format.  ,    ,  name   ,  number   .  format  ,      .  .








    .      ,      .

  ,       ,   ,       ,      .   ,       ,     .








  . ,          .     ,         .

  ,     format     .          .

   ,    .   ,     Python    ,     .

   ,     .     .2f.  ,        ,        .   ,        .








       ,      .     ,          .     ,                   .

      ,     ,           .

    ,    ,    .




    Python


 

 (List) -   ,     [].     .

 (Index) -     .   0   .       .

 -       .  Python     for-in.

 (Dictionary) -    -,    {}.     .

 (Key) -  ,       .    .

 (Value) - ,      .       Python.

 (Tuple) -     ,   .   (). ,     .

 (Set) -    .        .

 (Membership) -  ,     ,   , ,   .

 (Method) -  ,       .

 -          .






















  Python    ,    .

          Python.  ,       .








   ,      .            .    ,     ,       -    ,       ,     . ,      ,       .  ,        ,     ,       .








   , Python        .    ,    ,    ,     .   ,      ,     , ,  ,      ,    ,    .      .

      ,       .      .     ,  ,     .








  .                .     ,   type.

 Python  ,     ,       .

     ,   print.

      .    ,       len,    .

 ,     ,      in,    .








                .        ,        ,     . ,      0.  ,          1.

 ,          ?    ,       .

 Python      .    ,       ,     ,   for, ,   len    ,   +        in  ,    .








 ,     ,   ,       .

  ?      , ,   Python      ,     0    .

     ,        ,      .








        .      ,       ,    .

    ,      .   ,    .








        ,    ,  ,    .  ,    ,      .








    append      . ,   ,     .             append.








       ,    ,    insert.  insert  ,    ,      .        .     ,    ,       .








 ,       ? ,  .     ,   ,     .








      .    ,   ,   .  remove        .








 ,     ?    ,  ,     .








       pop,   .  pop  ,      .         ,    .

  ,         .

      ,          list.








         .










,      ,         Python.        for,           ,    in   .








      list comprehensions       .

    ,   list comprehensions    ,       ,              ,     ,         .

     ,         ,   for   .

,  ,        n   ,  n  .

      , ,    ,      .








    .  Python         Python.    ,     ,     .   ,     ,    .

 ,    ,      .      ,      .         .

     ,        ,     .    ,   ,      ,     .

    ,     ,           ,   .








         -,     ,   ,      .      ,     .    ,    .      ,  ,      .

Python ,     .      ,        .








       .      ,     items.     ,     ,        ,    ,         .















           .           dict.

         ,  ,      .








            dict  .








  ,      .     contact_information.      ,        keys    for.








           keys      .   key       .     .








 ,       ?          values.

 ,     ,  ?








      items  .   Python   ,      ,   ,  Python         .         .

    ,     .  Python    ,            .     , ,   ,  .








     ,     ,      ,    .           ,    .

  ,     ,   ,  ,     .








   ,    10 .       ,   ,    .








,     .       for,                 .       count   index.

 ,        .       .    .








 Python    ,   .        .          .       ,   .        .

   :       ?     ? ,  ,      ,    ,        .   ,    ,     

    -    .       .








      ,    .      .      ,      .       - ,     ?   ,      ,    .     .  ,         .

       Python.         .      ,    .








,      ,   .     ,  ,      .

,   ,   .    ,   ,    .








   ,      ,    .  ,            .    ,  ,    .

 Python       ,          .

,           ,          ,    ,         .

  ,     .     ,    ,       ,      ,         .








 ,           ?   -    .    ,        .








          pop,     ,  pop    ,     ,    .




      


  ,      ,     Python     .        Python   -,    ,      ,     ,        .

  ,      .








       ,   ,      .








      ,       .       0       .

 ,       ,    ,      .








       ,     +.            append.        .








    ,   ,       .       ,         .















  ,      .         .

     : , ,   .        .       0    .

 ,      ?          .  -      ,    .








      ,    ,    .

      ,        .








       100,   .        .

     .








   ,        .








  ,    ,      .   ,        .

    ,        .








     contact_information,      .  ,      ,   ?     .








     ,    .      try-except.       ,     .

   try     ,   .      ,   except     ,     ,    -    .    ,         .

 ,   ,    get.  get   ,     ,     .     ,     None   .        .   ,    ,    ,  get  None.








  ,     None,     -  ?  get    ,    ,    .








     pop  ,       . ,     ,    .







     ,   ,      .    ,        .

       Python.  print,     ,  type,      ,  str,     .      ,       Python.   ,    ,     ,      .








    .       .    .     ,       .    ,         ,      Python.

     .   ,     def.     ,     .       greeting. ,      ,     greeting.       ,    .        , name,    ,   .       .    ,   ,    .  ,    .    Python,       .   ,        .

       ,    print.  , ?           .      ,   ,     .








       :   ,     .     .        ,  ,           .       .     ,     , ,    .

 ,         ,   ,       .       ?         . ,   ,    .

,      ,  ,                ?    ,    ,    .








     .     ,   ,   2. ,           .     ,     .

,    .     return,   Python,     .    ,      .

,     ,        .        .       . ,   ,    .

      ,  area triangle  , ,    ,   .           .     area_a  area_b.      ,       sum      .     return.          ,      .








 return  Python  ,            . ,       ,         ,   .

     Python.       ?         .          . , 5 // 2     2,5.      ,      ,   ,      ,        .      ,      .








  ,     ,       .

   ,      .    ,    .








        .   ,  ,        ?

,    ,   ,    .       result,       return.

  result  None. None        Python,    ,       .

 :








  :








 :








 :








:















 :








 :








    ,          .








,   ,       def.     ,  ,    . , , .    ,     ,    Python   , -       .    ,     ,       .

    , Python     simple,   ,       ,      .








  ,  - ,   .  ,        result?

 ,    result  None,   ,   Python       None.       ,  , ,     , Python      None.

       ,        return.








    ,      ,    .           .

,   ,            ,   .  ,            ,    16.

  ,       ? -    .








     .     int, -     .     ,    Python.

       .          .








  ,    .              .

       ,      ,       .








, ,  ,      , -    ,    ,     .

       ,     ,  ython   .

  ,            ,  ,       .








  ,        ,    ,      ,       100  .








    , -             .















    .        .   .      ,      .              -.

    ,  ,       .             ,            .








  .     len,    .           .  ,   ,    .  ,     ,       .   ,    .

,            ?        ,  ,     ,  .   ,    ,          ?








       ,   ,    . -,   ,  lucky number,         .      ,      .

       ,      ,       .       lucky number  ,   ,      ,             .

 ,         ?     ,         .        , ,          -,      .     ,   ,   .

              ,        ,         .       -   ,            ,      .          ,        .

,       ,     ,   .   ,           .             .     ,    ,    ,        .      ,    .

        ?    ,        ,       ,   .

-,  ,      .     ,         .         ,       ,  .








,  ,   .     ,    .       ,   , ,   ,     ,       .   ,    ,     ,     . ,      ?








          ,      .

       ,        .   ,  ,      Python.








    (#).      ,  ,    ,        .

   ,    -  .             ,   ,     .




 


      Python? -              .








   ,   ,    .

def marco(name):

if name == "Marco":

return "Polo"

marco("Marco")

'Polo'

    .     ,    .

 ,       ,    ,     .     ,     Python  None.

marco("Bob")

      ,      .     Pandas DataFrame.       AWS Lambda. ,     -?

  ,   ,          Python!        .  ,        ,      .

:   ,      - ,   . , -  :

if dollars == 1000:

return "rich"

?  ,      ,    .      ,    .  Python   def,    .      .     (),    ,     :.     - .

    ,    Marco.  ,    .           - ,           .

def somename(somevar):

#some logic

return someresult

   ,    ?    ,          .     .

def simple_marco():

print("Marco Polo")

simple_marco()

Marco Polo

   ,         .      .     return_value   ,   None,    ,   .

return_value = simple_marco()

print(return_value)

None

   ,      ,      .   ,   , Marco  Polo,  ,    .

def medium_marco():

statement = "Marco " + "Polo"

return statement

return_medium_marco = medium_marco()

print(return_medium_marco)

Marco Polo

 return_medium_marco ,   .   return_medium_marco ,   Marco Polo.

:      .

   .     ,   ,    .

def input_marco(name):

if name == "Marco":

print("Polo")

else:

print("Nice try. No Cigar!")

  Marco,  Polo.

input_marco("Marco")

Polo

   ,    .

input_marco("Bob")

Nice try Bob. No Cigar!

 ,         None.

result = input_marco("Jenny")

print(result)

Nice try Jenny. No Cigar!

None

:        .




   


 -    .    .

 - ,   .       .

- ,  .      .

 -  ,     .    .

 -      .      .

 :

class Vehicle:

wheels = 4 # Class attribute

def __init__(self, make, model):

self.make = make # Instance attribute

self.model = model

def description(self): # Method

return f"The {self.make} {self.model}"

car = Vehicle("BMW", "i3") # Instance created

print(car.wheels) # Access class attribute

print(car.description()) # Call instance method 4

The BMW i3

 :

class Pet:

def eat(self):

print("Chomp")

class Dog(Pet):

def bark(self):

print("Bark!")

dog = Dog()

dog.eat() # Inherited method

Chomp

Bark!

 ,    ,        Python.  , ,  ,    ,               ,      .








,         class  Python.      ,     ,      def,  ,   ,         .

  pass ,     ,  .   4   .     6    .      ,    .  ,  .

  ,    ,     ,     .








, ,   ,       .         ,   _init_    ,           .

,   -  ,   ,  , ,          ,   ,    .








      ,      .   3     ,     .

   ? -   Python       .        Python,         .        ,    Python   .








      Dog   ,    .

  5    is_animal   True.    .     .      ,     - ,   .      ,    ,      .       ,  ,  ,   7,  .

  ,  ,   10.      .








     ,    TypeError.

  ,   bark  0 ,    ,     .  Python    ,       self.    .  ,   ,    ,     ,      self.








     ,  bark  woof.

     ,   .      , -      ,   .

    .








Dog.is_animal   .  ,          ,       2,      ,    .

,  ,    .








     ,   .        init.        .

  6   self  ,   self.is_animal  true.     ,        ,   ,     self.

 self?    self    .

  ,         is_animal       ,     .   .








      .  ,     self,      self    .








    ,      ,     .

   Animal   self,        name,   -,   , legs  barks.    self       .

   info    ,    .       10.








,        12?

 name  .    ?

    name    .   self.        ,    .       ,    ,   self.








    ,     .






     ,       .








     .       5,    .         8.

   ,      .  self.budget    ,     .      self.budget.








     ,    ,  report.        expense.

      ,      .








 self   ,        .       .     ,         .

      ,   .           .         ,       ,    .















     Pet,     ,   eat().

          eat(),    , -     food.








   ,  ,   ,       .             ,    .

     ,    ,    .








         eat,    ,          ,     .








  ,      .







   Python,    ,     .

  import   ,        .

 virtualenv   ,   / Python.

        Python virtualenv.

 pip   Python  /   .

# Import module

import utils

# Access function

print(utils.format_name("Wyclef"))

# Virtualenv creation

python3 -m venv env

# Activate virtualenv

source env/bin/activate

# Install dependency

pip install pandas

# Deactivate when done

deactivate








 Python     ,   Python,   py.  ,    .      ,      .     -     Python   , ,  ,   , , , 200 ,       .

,          .           .

    CLI,   .   ,         py.

  Python     .








   Python  OS,   ,      .

 ,   ,  ,     .py,  ,         .

    .








    utils.py,   Python. ,     .








   utils,     dir    ,    utils, -  ,    str_to_bool  str_to_int.








   utils,  ,      .

         .








    ,     import  utils,       ,    .   , utils    ,             Python.

   utils.,    ,     .       .

  ,      , -       ,        utils.py.








      ,        from import.    util        .















     .    Python  ,     .

 ,     .      program,    ,      items  .

  ,         Python,       .








         ,     ,         .   Python    ,     ,     ,    .

,     Python?

    main,       .

,           ,       ,   .

if __name__ == "__main__":

       ,     .

if __name__ == "__main__":

print("Script is run directly")

else:

print("Script is imported")

  ,   ,  - , Python,     ,   ,   .

     ,      main, , , ,    if __name__ == "__main__":   .

      sys.argv  sys,      ,   Python.








            ,        sys.argv.

      ,   ,   Python    .  ,   Python,        .    ,     ,    .








          Python,      .

        python3.   -m     ,      .   -m,     Python   .

      venv,     ,          Python,    .

        venv.  ls       ,     .   python3     ls,    venv.   tree      .








,     ,  ,             ,      ,    - . ,        ,        .

,   ,     .








   ,    source,   venv/bin/activate.     python,     venv.      pip.  , ,    , , Flask,    pip install flask,  Flask    venv    .








,  ,   ,     deactivate.




    Python


 IT-, , ,         .          ,     .

  ,          ,         . ,   Python           -  .

 , , ,  ,   Mac OS, Windows  Linux,            .         ,    ,    .

       ,        .   ,   ,     ,       .

          . ,    Windows      Jordan  C:\Users\Jordan.    Linux       /home/jordan.     ,     ,       ,       .

  ,      ,  ,   ,    .      ,   ,       .    ,        .

,      examples,        ,    .      /home/jordan,    /home/jordan/examples.      /user/share/doc/python3,    /user/share/doc/python3/examples.

     ,           .      ,       .             .

      .    ,          ,     . Python   .     ,          .








       spider.txt,     .             file. ,     open,   ,    .     ,  ,    ,     ,   ,   ,          ,      .

   ,      ,   ,          ,       .  ,  ,        .

 Python        files.

 file    ,        . ,     file,          .








    readline.        .     , ,  . .        .

,   ?  ,     readline,       .  ,    .








     read,       ,     .

     .        readline,         read.

  readline,  read     ,      .          .








,       close.

  --          .    ,    ,      .

-,     ,     ,           ,    .

-,     ,    ,      .      ,         .   ,    , ,  .

-,          ,  ,             ,      .      .

     .    ,  , ,   ,     ,    ,     ,   .  ,  Python   .            , Python    ,    with.  ,   .








 ,   with    ,  ,      .               .

   with Python   .        .

   --,     with    .

  with          ,        .

  ,  open   ,           .  ,    - .         ,      .

        ,       Python,     .   ,      . , ,         .








        ?  ,          . ,  Python      line,          .  ,         .    Python  ,        ,   .    ,     ?








    ,    ,     . ,     strip     ,      ,    .








             .    -   , ,  .         readlines.

  ,     ,  lines     ,      .








,     .   ,        .

      ,        ,      . -,  ,  Python     \n    .    ,        .

 ,  read  readlines,     , ,             .    ,       ,      .

      ,        .    ,     .

,   ,     Python,    , ,     .








  ,    write      ,    .     open  .      w?

       .    .  ,      ,     .

      r,    .     ,    ,      .       ,     r    ,      .

        .  w   open,        .    , Python  .   ,       ,        .

 ,              .     ,   .








        ,    ,   ,  a         r+     ,       ,    .

         ,    ,     .  ,        .   ,        .      w ,           .

 ,      30,     ?     .         .     30.

    , ,     ,  open    .          .

 ,   Python,  ,       ,         ,    .            -.   Python    ,             ,     URL-.

             ,     ,   C+  JavaScript.

   ,   .

         ,     Python,    .        ,       .








   ,   ,    , -  ,  ,   .  Python      ,     .

          .

  Python     , ,    ,   .

           ,      . ,    Windows     ,  C  D.  Mac  Linux     ,   .

        . Windows     .

      ,       .

   ,   CWD   . os.getcwd,     ,      .








    ,     CWD.

                Python     .








      ,       ,  os.listdir().








           ,  os.environ.get.

 ,    ,   ,      .    ,     ,  , ,         . ,  ,    ,      , ,          .

      ,   .       Python   .       ,     ,     Windows, Mac, Linux     ,  Python.  ,           ,  Windows,        ,   Linux.

   ,     :        .   ,        ,   ,      ,    .

         ,            .               .








     . ,     .     .   .








,  ,       .     ,   ,   .








        .         ,     .

       ,   ,       .

,   ,     ?    ,     , ,    .     .








        ,  ,   .

             os.path.








,    ,     getsize,      .

 ,    ,    getmtime.     ?     ,   ?  ,    .     Unix  .       1  1970 .         ,     .








    datetime,     .

    fromtimestamp  datetime   datetime.








             .

      ,        .      abspath.

 abspath         .

Python    ,    ,        .  ,                ,   .

        ,  ,     . ,      ,    ,       .

     , Python    ,  ,     .








 ,         Python,     getcwd.

   ,  Unix, , , ,  ,    ,  pwd.          ,     ,          Linux.








      mkdir.      ,    Windows  Linux,     .








       ,   chdir      ,     .

    ,   ,         .  ,        ,       .








  mkdir   ,      rmdir   ,   rmdir      .     ,   ,   .      ,     ,      ,     ,     ?








  ,      .  os.listdir         .








,     .    ,   ,      .  ,   ,    ,   os.path.isdir,   ,      .    ,       ,    os.path.join    .

-,    dir   ,    .           .

    ,   os.listdir.       ,        . ,  os.path.join,            .

,    ,   os.path.isdir  ,      .

,   ,     join? ,        .  join        .  Linux  MacOS        .  Windows       .   os.path.join     ,   ,    

   .        ,          .

    ,   ,      ,  .       ,  .            .    .








    ,   ,        ,      ,   ,    .          .

     ,  ,    . ,      . , HTML    ,   -. JSON     ,         ,   . CSV,  ,  ,      ,        ,  .

   Python             ,  CSV  HTML.               ,      Python.

 ,     CSV   CSV-.    ,     Python,      .    CSV-    .         ,      , ,         .

      CSV-, ,  ,   Microsoft Excel  Google Sheets.

CSV   Comma Separated Values (,  ). CSV    .       .     CSV-      .       ,      .

  Python    ,    ,    CSV-.








,     CSV.        ,       . ,      CSV-,       ,   .       ,   CSV.








         .

 row     CSV-.     ,     CSV    .     ,    ,    .

 ,    ,       . ,     ,           ,     .

    ,     .    ,   ,              . ,     row[0]     .  ,          .          .

          .     ,              . ,             .








   ,    ,  .    .  ,      CSV-,         IP-.

, ,      ,      .     with,     .

,        ,      CSV      .

 writer    CSV writer.   ,    : writerow,        ;  writerows,      .         ,    .    writerows.

 ,      CSV-.

 ,       CSV-,       Python.  ,   ,   ,     ,     ,    ,      .

,        ,    ,     ,  ,  , ,     .    ,       .

     CSV-      .        ,  DictReader,   ,     CSV.








       CSV-  .       ,       .

,       DictReader    CSV-, ,   ,         ,    ,        .








   DictWriter     CSV-    .  ,         ,         .

       ,          .

      ,    .              ,    .

,     ,      : ,    .      HTML-,     .     ,     ,     .    DictWriter,  ,    ,         writer.

 rightheader    CSV-     ,   rightrows       .




 


     .

         ?  ,    regex  regexp,  ,      ,   .

       , ,       ,     .

      , :      ?          ?

 ,        ,   .       ,    .  -  -,     ,       ,     .








, ,     .         ,        12345.

    : ,    ,  ,     .

     ,   ,       . ,              ,   0.

   ,   ,       .     ,     ,         .     ,      .      ,       .








             .     RE ,          .

       ,           .








         . , grep        .

grep     ,  ,    .

   grep      /usr/share/dict/words,   ,      .








      .    ,    thon.

     thon -  ,      .   ,   ,     .

 ,  ,    grep,   .








            -i  grep.

      ,       ,    ,  .  ,     ,       .         .








,    .  , ,       ,     ,      .

  . ,            .















    ,      :      .  ,        from.    ,       .

 ,      re   .








     re     aza  .          . r   ,    .  ,   Python     -  ,           .      .

,      print    , ,   .








       .     ,   .  ,        .

  ,  ,    ,    ?








      ,      . ,  None    ,  Python ,  ,     .








        .

  ,      ,    .








 ,    ,     ?

    ,     peng.

      ,         .        ,      .  ,    -  , , ,      ,       CSV-,   ?

         .         ,   .








          ,    ,   . , ,     Python,    ,     p.








           . ,        a  z     .








   .       .  ,     ,       .








    , ,  A  Z       0  9   .       ,  .   ,      ,     .








        ,     .        . ,    ,    ,  .

,       ,     ? , ,  .       ,         ,       .








     ,   ,       (|).      ,    . ,     ,     ,   .  ,     ,     .

  ,   ,   .            .     .    .








      ,        findall,     re.

    ,     ,      .   ,      .








   ,   ,    .  ,     ,     ,  .

        ,       ,   n.

   , Python Programming.   ,     ? ,       .     ,     .








   ,      ,      ,  .

,   ,     ?    Pyn   .

    :    ,        .








       ,    .








       .    ,      .

     ,           : , , ,  , ,     .

  ,        ? ,   ,     .     ,     .








       ,          .

 ,     welcome,      .com,    none.








  -,    . .    ,   ,     ,   .

          ,  ,       .

    .       ,          . , , ,  \n  ,   Python    ,  \t      .

   ,    ,            .

  ,    ,     ,          .        .

 , Python         ,         .








, \w   - ,  ,   .

          ,         .       .

  \d   , \s    ,    , \b       .

         Python.    ,          ,   .

, ,       ,    ,          .    ?








, -  A.*a.  . . ,  .

    . . ,  ,    ,    ,  ,      . ,       ,      .  ,    .

      ,      .      ,    ,     ,       .      .

 ,    -  ,    , , .








  ,     ,   ,        Python. ,  ?      ,   ,      .

,   ,     ?

   ,  ,      ,            .       ,   ,   .       ,         .

 :  ,     ,   .        -,    ,       .  ,    .

      .

,        ,    .     ,       .

  -  .     ,      .    ,         .

    . ,       ,  ,     ?          .

      ,  ,     .  ,     ,     .              - . ,                   .        ,   .      ,   .








,      .      , , .       ,    ,    .           .

    ,    ,    , ,      .

     groups.      ,  group     .          . ,      ,   .








    ,    .    ,      .         ,    .    ,  ,      .         .

     . ,    ,      . , ,  .








 ,     -   ?     ,      \w,    .           .    ,   ?     ,      .








        .        .

 ,      ,   ,    .

       *, +  ?.  ,    ,     ?   ,    , ,   ,     ,      .

             ,  .         .   Python     .








            ,  . ,    ,     ,    ,  .

     ,    ,    ghost  ,     .

            ,     . ,    ,    ? ,   findall.

,       ,      ?       \b,           ,  ,      .








 ,         . ,            ,    ,  .

     . ,    ,       ,        .

,    , ,    ,       .








  .       .

     ,     escape-.  ,   ,      ,  .

     .    ,  ,        .

       ,  ,          .

    ,       ,    escape-.

     , ,      ,          .








 ,            ? , ,  ?       1 ,  .

    ?     ,      PID,   ,      - .








    .         ,   ,         .

  , ,     ,   .

,      PID,    .

         re: search  findall.       ,         ,    .      split.     split,      .           .








,        .        ,      ,       .

 ,     ,     .  ,  ,     ,    ,      .   ,      .

  ,       ,      ,    .      ,        .








   ,   re,  sub.              ,    ,        ,    .

        ,      ,     ,   .        .

,        ,    :    @    .

   ,     @.   - ,  \w,  ,    ,   ,  ,   .   @    -    .       ,    ,          , , ,   .    .

    ,    .     ,       ,       .

     ,       .








       ,   ,    :       .          .

  \2    ,    ,  \1    .       ,    ,    .      ,     ,   ,    Python.

       ,         .




   


       .                .

           ,     .    Python   input.       ,      .








 ,   .     hello.py.   :    ,    ,   .

       .  :  input   .        ,   ,       .








  .     ,     .

   ,   ,       .            while.  :     cont,      ,     .

   while      ,     .         ,   ,   input,    int.    ,      .    ,       .

             .         ,           .         ?    Python     ?








    -.  -           .            (, )    (, ).

      ,    -,        .              ,     .

   ,    :          ,      .

     ?          -,      .








   (STDIN)         ;    ,   .     input    Python     ,     STDIN.

   (STDOUT)        ,  .  ,   STDOUT          ,     print     .

    -     (STDERR).  STDERR,    ,    ,            .   -     Python     , ,  ,      .








     .      ,        .          ,         .       ,      .        .








  -       Python. ,      cat    .            .      ,         . ,       ls (    ),     .

 ,            .    ,       ,       .           .

,      :  -   ,        .

       Linux       ,  ,      ,   (shell).           .

    Linux   bash.     Zsh  Fish.     ,     Linux     bash.

  Python     ,  . ,        (  )  ,      ,     .

         ,      .         ,    .

           env.








 .     ,     ?     .     . ,  PATH   .








       echo. : echo   ,    Linux   .        ,       .

      `PATH`.     ,  ,    ,          .         .

   Python 3     ,    PATH.     python3,   .

   ,        Python.     ,  .








        environ   os.       get.

 get         ,    :    .        (, os.environ['FRUIT'])      ,  .   get   ,   ,    .  ,   get       ,      .

   Python   ,   ,         .       : HOME, SHELL  FRUIT.

  ,        ( ).  ,   export   (shell),           .

           .  ,      .     ,          .          ,      .           :         .            .








         argv   sys.

     sys    sys.argv.  ,     .        - .           .

   .   ,        .








 ,      (  )               .

    ,    .   Unix-       ,    ,       .

       ,      .   ,    ,   ,    ; ,            .

        ,       .  ,   ;    ,         ($?).

      wc,    ,     .      variables.py    . ,    wc,     ,      Python-.      $?  ,     .   ,   wc  .

   wc     ,     .     ,      $?  ,      1.

     ,      Python?   Python  ,    0.       (, TypeError  ValueError),     .     ,       .








  .          .   ,    .   ,        .    ,          1.








  ,   ,     . , ,   .  :     0,        .   .

,    ,  ,     ?  :  ,     ,      1.

       ,    Python. ,        ,  shutil     ,   sys     ,      .

  ,          Python? ,       ICMP-  ,  ,   .     ,   .      ping,    .

            Python   ,    ,      Python.     Python          subprocess.








  .    subprocess,     date (  )    subprocess.run.

 run    CompletedProcess.       .    ,      0.

          ( ),      .           ,     ;  ,        ,       .

      ,    ,      .        .








 ,   ,    sleep,       . , , ,      sleep   ,       .          .

   ,    .  run  ,       ,       ,     .  ,  ,    ,       .       sleep    .

      ,    (returncode)       0.   ,      .    ls    ,         ,   .       returncode   ,        .  ,    ,      2,     .      ,       .

    run ,           ,    .      ,  ,      .      ,

      (, cp, chmod, sleep   ),         .  ,          . ,    ,          ,      chmod.    ,    .        ,     ,   .








  ,     Python      ,     run,     .   ,               .

, ,       ,          .      ,   who,    ,      .     ,       ,        .      ,    run      (capture_output)   True.

      host,       IP-  .      capture_output=True     ,     .  .  ,         CompletedProcess,     .       (return code),    .         ,     ;     stdout.

    b   ?    ,        Python.      .     .         ,       256  .     ,    . ,      10 000  .       ,        , ,        .        UTF-8    Unicode,     .








   :     run Python  ,       ,       .    ,    decode.         ;    UTF-8,    . ,       ,       .  ,            ,   . ,       ,   IP-.

.       .       (stderr)?      ,    -    ,      stderr   .








   .    rm (   ),     .    .         .     stdout  stderr.  ,        .    (    ),       stderr.    ,           ,  Python    .

 subprocess        . ,   ,            .       ,     ,        ,   ,   .

       :      ,   ,        .








 ,   .         copy()   os.environ,    .    ,      ,    .

          PATH. ,   PATH ,      .    PATH,        .

       join()  os.path.     ,   ,    .       /opt/myapp     PATH    . ,    myapp,      .

 :       PATH,     ,     myapp     .              PATH.

  run      . ,  cwd     ,     .        ,        .

    timeout.     run   ,      ,   ( ).  ,    ,      ,     ,     -.

 ,    shell.     True, Python       ,       .           ,  ;   shell    .

       Python (     )   ,       .       .     ,        ,     .    ,        .       .

    ,    ()  ,     ?  ,       Linux  Windows?              , ,  ?        ,  ,   .

   ,     .    ,         ,         .              Python. ,      ,        PyPI: ,      Python  -      .  :    .








       .      open,    ,         for.

:              ,       .

,    -   . ,   ,   ,   ,      CRON,     .

,   CRON          UNIX.  ,    ,    -   ,    CRON.

   ,  ,       ,   CRON.       ,   CRON (   ).








 ,     ,    CRON.        in.      continue,       .

 ,      ,       . ,      ,         .     .        ,      .

       ,      ($),       .    ,    user,            .  ,          .       ,          .        -     \w+.

  ,       .   ,    ,        .   ,     ?     ,   .       ,        .








        ,      ,       .     ,   get,    .

     ,      .        .          ,   get    .      ,        ( ,      ).             .

,     . .   ,     ? .  ,       ,      ,   ,    .      .








        .      ,  ,      . ,   ?  ,      None.

    ,   :    Non,     continue. ,        ,          .     name,      ,        .  ,       .







       ,   ,   ,    ,      .      ( ,      )      ,       ,  .

      .         ,       .  ,      ,      .      ,     .      ,  ,       ,       .      :   ,               .

        ,      .     ,         .    ,        ,   .      ,     .       .

  ,      ,      ,    ,  .           ,         .             ,     .          .                   .

               .          ,       ,         .    .            .             ,     .

        .        ?      ,          .         ,    (test cases).

,              ,    .    ,   ,    ,    .     ,              .   ,    ,     ,  ,  ,    ,   .

 ,          .      ,           ,     ,  .                 .  ,     ,   .    .         ,      .

      ,      ,       ,       .           ,   ,     .    -      ,  ,     ,    .

       .        (unit test).           .       ,         ,   .     ,         ,  .




  .


   .

   ,     (https://www.litres.ru/book/timur-mashnin-30184546/programmiruem-na-python-74982087/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


