Skip to content

Python

Python Logo

Official website

This is the introduction to Python notes, the notes are divided in:

  1. Basics.
  2. Intermediate.
  3. Libraries and Modules.
  4. Frameworks.
  5. Projects.
  6. Scripts & algorithms.
  7. Virtual environments.

Some useful information

How to know the import path

import sys
print(sys.path)

How to know the current directory

import os
print(os.getcwd())

How to inspect a module

To inspect a module we can use dir(name_module) and it will output all information about the module

About Python Packages

  • Function: Container of variables and expressions
  • Class: Container of variables and functions
  • Module: (roughly) represent a python script which contain class, function, variables, and expressions
  • Packages: Solution to manage python modules. Contain multiple modules and the file init.py

some more information here Making a Python Package

Some Good Rules

  1. Be explicit
  2. Import Only what you needed
  3. Give the right names to packages imports and variables