5

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?

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Kwang
  • 211
  • 1
  • 3
  • 7
  • please look at : http://stackoverflow.com/questions/12229580/python-importing-a-sub-package-or-sub-module there is a nice answer there – Eyal Ch Dec 27 '15 at 07:39

1 Answers1

7

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.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358