Hey,

I am new to python and was wondering how to import modules?
I want to import the datetime module. Do i have to download it from a website?

Thanks

datetime module is standard, just import it in begining of your program with

import datetime

Have you tried to search this forum for "date time python"? There is much usefull information here like this

Edited 5 Years Ago by pyTony: n/a

Some practical considerations ...

# import all functions in module
import module1
# call function func1()
module1.func1()

# import all functions in module, but use a substitute name
import module1 as md
md.func1()

# import specified function in module
from module1 import func1
# call func1
func1()

# import specified function in module, but use a substitute name
from module1 import func1 as f1
f1()

# import all functions in module into the present namespace
# use sparsely, beware of name clashes with other functions
# (does not allow access to module variables)
from module import *  


# list all the modules Python currently knows about ...
help("modules")
This question has already been answered. Start a new discussion instead.