ITEC 111 Python 02 - Intro To Python Part 2
ITEC 111 Python 02 - Intro To Python Part 2
ITEC 111
Python Virtual Environment
While developing an application in Python, one or more libraries may
be required to be installed using the pip utility (e.g., pip3 install
somelib). Moreover, an application (let us say App1) may require a
particular version of the library, say somelib 1.0. At the same time
another Python application (for example App2) may require newer
version of same library say somelib 2.0. Hence by installing a new
version, the functionality of App1 may be compromised because of
conflict between two different versions of same library.
Create new Virtual Environment
This functionality is supported by venv module in standard Python
distribution. Use following commands to create a new virtual
environment.
Activate/Deactivate Virtual Environment
To enable a virtual environment, execute activate.bat in Scripts folder.
Basic Syntax
Let us write a simple Python program in a script which is simple text
file. Python files have extension .py.
• Multiline Comments
• Docstring Comments
Python - User Input
Every computer application should have a provision to accept data
from the user when it is running. This makes the application interactive.
Depending on how it is developed, an application may accept the user
input in the form of text entered in the console (sys.stdin), a graphical
layout, or a web-based interface.