How to use 'python for each key in dict' in Python

Every line of 'python for each key in dict' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
464def dict_iter(dct):
465 for k,v in dct.items():
466 if isinstance(v, dict):
467 for kk,vv in dict_iter(v):
468 yield (kk, vv)
469 else:
470 yield (k, v)

Related snippets