Import the module first

why did not we import the module first before importing the class like what we were doing
(from csv import reader)
I tried to write “from datetime import datetime as dt”

but it gave me an error!!

1 Like

Hi @SherifSaad,

This article will help you to understand it:

In short, by using:
from csv import reader

You are importing only the reader() function.

Whereas if you do this:
import csv as c

You are importing the entire module and giving it a nickname (alias) for easy reference. After that, you can call the reader() function using:

c.reader()

Best,
Sahil

1 Like

many many thanks to you

1 Like