Virtual Environment is used to create isolated python environment. In simple terms it creates a virtual installation of Python and Pip into some directory. It is separated from your original python installation. Why we need virtual environments? Suppose you are working on some project and that project required more than 2 libraries that are dependent on each other. Generally these libraries are open sourced projects and maintained by different developers community. Now, if any one library gets changed in newer version and it is not backwards compatible and if you accidentally update that library from your global python installation then it might break your project.That's why it is safe to use virtual environments. To create virtual environment in your machine please follow these steps: Make sure you have installed python in your computer.In this guide I will assume you have installed python 3.(make sure to check add to path) Install virtual env via this command $ pip i
In this blog, I will give you the basic but important information regarding the Exceptions in Python. As we all know, we always get some Errors and Exceptions in program every now and then, so to know what that exception is all about. We should know all about exception. So, let's dive into it. First of all, let's understand what Exception is? If a statement or expression is syntactically correct, it may cause an error when an attempt is made to execute it. This errors detected during execution are called Exceptions. Example:- Exceptions are of different types and this error message indicates what happened. Like you see here in example i.e. ZeroDivisionError, NameError, TypeError. These are basic errors in the program. List of Standard Exception :- Exception - Base Class for all the exception Stop Iteration - Raised when the next() method of an iterator does not point to any object. Example :- System Exit - Raised by the sys.exit(