This commit is contained in:
Marc Beninca 2024-06-25 11:28:32 +02:00
parent e76656855d
commit 1fb36aac9e
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -4,7 +4,7 @@ Snippets
Hello world Hello world
----------- -----------
.. code:: python3 .. code-block:: python3
if __name__ == "__main__": if __name__ == "__main__":
print("Hello, world!") print("Hello, world!")
@ -23,17 +23,28 @@ Links
Remove Remove
^^^^^^ ^^^^^^
.. code:: python3 .. code-block:: python3
import shutil import shutil
shutil.rmtree(path) 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 Web
--- ---
Get Get
^^^ ^^^
.. code:: python3 .. code-block:: python3
requests.get(url).content.decode(charset) requests.get(url).content.decode(charset)