Back to articles
Python Overview

Python Overview

via Dev.to PythonKALPESH

Python Modules A file with reusable Python code (functions, classes, variables). Example: custom .py files or sys, math module Python Package A folder with related modules , including an __init__.py file. Example: numpy or custom module directories. pip is a tool in Python to install & manage Python packages or libraries from the Python Package Index (PyPI) . Python Virtual Environment Isolated environment for project-specific dependencies. Create: python -m venv <env_name> Activate: source <env_name>/bin/activate Command Line Args Python in build sys module import sys # python inbuild sys module, which is used for command line args num1 = float ( sys . argv [ 1 ]) Environment Variables Env vars used for sensitive data, which we can’t hardcoded: API keys passwords tokens certificates Declare Env vars in terminal: export password=”pass@123” Code: import os pass = os . getenv ( " password " ) File Operation of Windows Open : open() with modes ( r , w , etc.), e.g., open("file.txt", "r")

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
3 views

Related Articles