diff --git a/rtfd/public/python3/snippets.rst b/rtfd/public/python3/snippets.rst index 9d355f4..c2874ff 100644 --- a/rtfd/public/python3/snippets.rst +++ b/rtfd/public/python3/snippets.rst @@ -4,7 +4,7 @@ Snippets Hello world ----------- -.. code:: python3 +.. code-block:: python3 if __name__ == "__main__": print("Hello, world!") @@ -23,17 +23,28 @@ Links Remove ^^^^^^ -.. code:: python3 +.. code-block:: python3 import shutil shutil.rmtree(path) +Log +--- + +.. code-block:: python3 + + file_handler = logging.FileHandler('log.txt') + file_handler.setFormatter(formatter) + file_handler.setLevel(logging.INFO) + + logger.addHandler(file_handler) + Web --- Get ^^^ -.. code:: python3 +.. code-block:: python3 requests.get(url).content.decode(charset)