Reading Time: 1 minutesRaising your own Exceptions in Python Raising your own Exceptions in Python The raise keyword is used to explicitly raise an exception. This is in contrast to when you make […]
Month: January 2017
Python: Manipulating Files
Reading Time: 1 minutesManipulating Files in Python Manipulating Files in Python The builtin open() function is used for opening files. This function returns a file object, which has methods like read() and write() […]
Python: Using iter() - The Iteration Protocol
Reading Time: 1 minutesUsing iter() in Python - The Iteration Protocol in Python Using iter() in Python - The Iteration Protocol in Python Sequences and file handlers in Python have an __iter__() magic […]
Python: Getting user input - builtin function input()
Reading Time: 1 minutesGetting user input in Python Getting user input in Python The builtin input() is used for receiving input from the user. The input() function takes an argument, which is what […]
Python: Handling exceptions - the try-except constructs
Reading Time: 1 minutesHandling exceptions in Python Handling exceptions in Python There are instances when your code doesn't go as planned. Python provides the try-except constructs to handle such situations. If a statement […]
Python: Using builtin functions any() & all()
Reading Time: 1 minutesUsing any() & all() in Python Using any() & all() in Python Python provides two useful functions to check for true values of an iterable object. The any() function returns […]
Python: Using builtin functions globals(), locals(), vars()
Reading Time: 1 minutesUsing globals(), locals() & vars() in Python Using globals(), locals() & vars() in Python globals() The builtin globals() function returns a dictionary containing objects accessible anywhere in the program. locals() […]
Python: Creating Secure Hashes/Message Digests using hashlib module
Reading Time: 1 minutesCreating Secure Hashes/Message Digests in Python using hashlib module Creating Secure Hashes/Message Digests in Python using hashlib module The builtin hashlib module provides an interface to create secure hashes/message digests […]
Python: Using the nonlocal keyword
Reading Time: 1 minutesUsing the nonlocal keyword in Python Using the nonlocal keyword in Python The nonlocal keyword is used when you are dealing with variables with same name but in different scopes. […]
Python: Returning values from a function - The return keyword
Reading Time: 1 minutesreturn in Python return in Python The return statement makes the control exit from a function, with an optional expression. A return statement without an expression is as good as […]

