627 shaares
Quelques tips pour debugger du code python avec print()
, notamment:
- Debug variables with f-strings and
=
:print(f"{myvar=}")
- Use
locals()
to debug all local variables:print(locals())
- Use
vars()
to debug all of an object’s attributes:print(vars(myobject))