Site icon NetVital

Python Standard Library

Python Standard Library

Python Standard Library

Python Standard Library

With Python Standard Library, we call module code that is ready to use. We cannot use these modules without recall and if we need, we must call them.

The Python standard library is very extensive and offers many features. In this library, we see internal modules that are often written in C language. For example, we can access the file input/output system through these modules, without these modules, Python programming will be inaccessible.

These modules provide increased programming capabilities. In the installed version of Python in Windows or Mac, usually the entire standard library also install and accessible and there is no need to add them, but in Unix, they are a set of packages that we can install separately.

Modules are the main unit of code in Python and there are two types of modules in Python:

we have many Modules in Python, for example Modules:

How we can recall a library in Python:

for recalling, we have two options:
  1. Recall all module: In this way, we recall all module and when we want to use commande we write module. Submodule (X)
  2. Recall a specific sub module: In this way, in command we write just submodule (X), and it doesn’t need to write module name before submodule
here a command for recalling:
  1. import module
  2. from module import submodule
let’s to see some examples by module random:
  1. import random
    random.randrange(10)
  2. from random import randrange
    randrange(10)
let’s to see video from our YouTube channel

 

If you want to learn more Python, please click here.

Exit mobile version