A module is a collection on Python Declarations intended broadly to use as tools. Modules are also referred to as "packages" or "libraries"
To use a module in a file the syntax needs to be located at the top of that file like this:
from module_name import object_name
'datetime' is a library that comes as part of the Python Standard Library. 'datetime' helps you to be able to work with date and time in Python.
Let's try 'datetime' by importing the 'datetime' module.
from datetime import datetime time_now = datetime.now print(time_now)
This outputs a combination of a date and time.
Attributes year, month,day,hour,minute,second,microsecond.
Lets try using a cooler module. Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.
import wikipedia print(wikipedia.summary("python (programming language)"))
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a "batteries included" language due to its comprehensive standard library.Guido van Rossum began working on Python in the late 1980s as a successor to the ABC programming language and first released it in 1991 as Python 0.9.0. Python 2.0 was released in 2000 and introduced new features such as list comprehensions, cycle-detecting garbage collection, reference counting, and Unicode support. Python 3.0, released in 2008, was a major revision that is not completely backward-compatible with earlier versions. Python 2 was discontinued with version 2.7.18 in 2020.Python consistently ranks as one of the most popular programming languages.
Top comments (0)