Use the python-varname library.
bash
pip install python-varname
python
from varname import nameof var = 1 nameof(var)
output
var
Recommended Posts