different modules in python 3.10

different modules in python 3.10

Consider module to be the same as code library. A file containing a set of functions you want to include in your application. There are different types of modules in python.

  1. Import 
  2. From………  Import
  3. Renaming 
different modules in python 3.10
different modules in python 3.10

Import Module in python 3.10

The import statement is use to import all the functionality of one module into another. We can import multiple modules with a single import statement, but a module is loaded once regardless of the number of times, it has been imported into our file. Create the module named as file.py

Import module1,module2,…….. module n 


1.	import platform

x = platform.system()


2.	import datetime

x = datetime.datetime.now()


From… import Module in python 3.10

Instead of importing the whole module into the namespace, python provides the flexibility tom import only the specific attributes of a module. This can be done by using from? Import statement.

From < module-name> import <name 1>, <name 2>..,<name n>  


1.	from sklearn.preprocessing import LabelEncoder

2.	from sklearn.model_selection import train_test_split

3.	from sklearn.preprocessing import StandardScaler

4.	from sklearn.preprocessing import StandardScale

5.	from sklearn.linear_model import LinearRegression

6.	from sklearn.linear_model import Ridge, Lasso

7.	from sklearn.metrics import mean_squared_error

Renaming modules in python 3.10

Python provides us the flexibility to import some module with a specific name so that we can use this name to use that module in our python source file.

Import <module-name> as <specific-name> 


1.	import numpy as np

2.	import pandas as pd

3.	import matplotlib.pyplot as plt

4.	import seaborn as sns

5.	import warnings

6.	%matplotlib inline

7.	warnings.filterwarnings('ignore')

Summary :

In this article we saw different modules in python 3.10 so about this section you have any query then free to ask me

Also see:

class and object in python

String Function in python

I am Mr. Sachin pagar the founder of Pythonslearning, a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

google ads

Pythonslearning protected By DMCA