Cookbook
Python
Collection of Python code recipies.
Display Python version
Display Python version in the current notebook.Install Package
Execute this code recipe to install new Python package in your currently used environment. ...Get current time
Get and display current time in PythonGet working directory
Get and display current working directory in PythonGet environment variable
Access environment variable in PythonAdd .env variable
Add environment variable in PythonLoad secrets from .env
Load secrets from .env file to environment variableRandom integer
Generate random integers in PythonTime delay
Learn how to add time delays in Python using the sleep() function from the built-in ...Check if file exists
Check if file exists in Python without raising ExceptionList files
Create and display list with all files in the selected directory with Python code. ...Read file
Read content from a file in Python. Use `open()` function to open file and `read()` ...Write to file
Write to file in Python. This code snippet constructs a file path, opens a file ...Append to file
You can append any content to file using Python. Python built-in functions `open()` ...Delete file
Use Python to automatically delete file from file system using os module and remove ...Copy file
Copy file in Python using built-in `shutil` module. Source file will be coppied ...Delete directory
Check if directory exists and if yes, then delete itRead JSON from file
Read JSON file to dict in PythonWrite JSON to file
Save JSON object to file in PythonPretty print JSON
Pretty print JSON or dict objects in Python. It is much easier to understand JSON ...
- Next »
- Display Python version