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
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
As tony posted there is much info on this site.
Take a look The Python Standard Library
All this is build-in an you can import and use it.
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")
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.