Dictionaries have a get() method
Explains how to use Python's dictionary get() method to avoid KeyError exceptions by providing default values.
Yasoob Khalid is a developer and writer best known for the free, open-source book Intermediate Python and his project-driven follow-up, Practical Python Projects. His articles and books have reached 5+ million readers across 189+ countries, and his blog remains a go-to place for clear, practical Python insights. By day, Yasoob works on Azure Cloud Networking at Microsoft, and by night he continues to publish tutorials, notes, and experiments that demystify real-world Python for learners at every level. He’s also the author behind the long-running Python Tips site and newsletter, where he focuses on approachable explanations and hands-on examples.
188 articles from this blog
Explains how to use Python's dictionary get() method to avoid KeyError exceptions by providing default values.
Explains the difference between the 'return' and 'global' keywords in Python functions, with code examples.
A tutorial on generating random strings in Python using the random and string modules, useful for creating passwords.
Explains the purpose and function of the __init__.py file in Python packages for organizing and importing modules.
Explains the Python 'with' statement for safe file handling, preventing corruption by automatically closing files even during exceptions.
A guide on using Python's built-in SimpleHTTPServer module to quickly share files over a local network.
A programming tutorial explaining a simple, one-line method for swapping the values of two variables in Python.
A programmer from Pakistan introduces his new personal blog focused on providing Python tips for beginners and intermediate learners.