Kwang
Kwang

Reputation: 211

Importing time module twice

I saw the code from Youtube and have a question.

The code below imports time twice.

  1. import time
  2. from time import mktime

import pandas as pd
import os
import time
from datetime import datetime
from time import mktime

By importing time on third line, I think 5th line is useless.

Why does he import time twice?

Upvotes: 5

Views: 127

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798686

Why does he import time twice?

He doesn't. He copies time.mktime to mktime. He doesn't have to, he just does so for convenience.

Upvotes: 7

Related Questions