Python Standard Library , Modules & Functions
Python Standard Library Overview
Python has rich set of standard Library, supply reusable modules which help python developer to work with data, Manipulate ZIP archive, highly complex functions etc. The standard Library contains Modules and which further contain Functions which are called in python code for specific task.
Let’s understand this with one example
Example 1: The Sys Module used as an example to know the Interpreter name of Python. Let’s see the example
Here in the above example, we are importing module sys, and then from module sys we are accessing its attributes called platform, which says that Windows NT is the name of your Interpreter.
Now let’s see how this Module is used further
Here in above example, we are using another attributes of sys, which shows the Python Version that is 3.4.3
Let’s use datetime library, to work with data and time data. The date.today() function provides today’s date. Let’s see that.
Even we can also able to see the day, month, year separately by using below function.
Let’s suppose you want to see the time in Hours and minute, the Module time has to be imported and then its attributes can be called in to it to see the time.
Here once we import the time module, call strftime() function and then specify how you want to see the time displayed. Let’s go with some deeper dive of datetime module