My personal python code snippets and tips.
python3 -m pdb -c continue Rozpis.py -p Bik 2024-06.xls
import subprocess cmd = ["command", "arguments"] result = subprocess.run(cmd, capture_output=True, text=True, check=True)
import argparse
parser = argparse.ArgumentParser(
prog = "Program name"
description = "program description"
epilog = "text at the end of help page"
)
parser.add_argument("filename")
parser.add_argument("-i", "--interactive", action="store_true", help="argument description")
parser.add_argument("-o", "--output", type=str, help="argument description")
args = parser.parse_args()
Style checkers, similar.
flake8 . black .
can do similar.
Check for common programming mistakes, import order etc.
pylint .
mypy .