Computer Science, asked by Anonymous, 5 months ago

Back with a question :- • Explain the Standard Modules in Python. Dont spam :)))

Answers

Answered by Anonymous
2

Answer:

A module is a Python object with arbitrarily named attributes that you can bind and reference. Simply, a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code.

Answered by AdorableMe
28

Standard Modules

  • Python comes with a library of standard modules also referred to as the  Python Standard Library.
  • Some modules are built into the interpreter;  these modules provide access to operations that are not part of the core  of the language but are either for efficiency or to provide access to tasks  pertaining to the operating system.
  • The set of such modules available also  depends on the underlying platform. For example, winreg module is  available only on the Windows platform.

Python’s standard library is very extensive and offers a wide range of  facilities. The library contains built-in modules that provide access to  system functionality such as file I/O operations as well as modules that  provide standardized solutions for many problems that occur in everyday  programming.

The Python installers for the Windows platform usually include the entire  standard library and often also include many additional components. For  Unix-like operating systems, Python is normally provided as a collection  of packages, so it may be necessary to use the packaging tools provided  with the operating system to obtain some or all of the optional components.

One particular module that deserves attention is sys, which is built into  every Python interpreter. This module provides access to variables used or  maintained by the interpreter and to functions that interact with the interpreter. It is always available and used as follows :  (Just as an example)

In []: import sys

# Returns a string containing the copyright pertaining to

# the Python interpreter

In []: sys.copyright

Out[]: 'Copyright (c) 2001-2018 Python Software Foundation.

\nAll Rights Reserved.\n\nCopyright (c) 2000

BeOpen.com.\nAll Rights Reserved.\n\n

Copyright (c) 1995-2001 Corporation for National

Research Initiatives.\nAll Rights Reserved.\n\n

Copyright (c) 1991-1995 Stichting Mathematisch

Centrum, Amsterdam.\nAll Rights Reserved.'

# Return the name of the encoding used to convert between

# unicode filenames and bytes filenames.

In []: sys.getfilesystemencoding()

Out[]: 'utf-8'

# Returns information regarding the Python interpreter

In []: sys.implementation

Out[]: namespace(cache_tag='cpython-36',

hexversion=50726384, name='cpython',

version=sys.version_info(major=3, minor=6,

micro=5, releaselevel='final', serial=0))

# Returns a string containing a platform identifier

In []: sys.platform

Out[]: 'win32'

# Returns a string containing the version number of the

# Python interpreter plus additional information on the

# compiler

In []: sys.version

Out[]: '3.6.5 |Anaconda, Inc.| (default, Mar 29 2018,

13:32:41) [MSC v.1900 64 bit (AMD64)]'

In the above examples, we discussed a handful of functionalities provided  by the sys module. As it can be seen, we can use it to access system level  functionality through Python code. In addition to this, there are various  other built-in modules in Python. We list some of them below based on  their functionality :

Text Processing : string, readline, re, unicodedata, etc.

Data Types : datetime, calendar, array, copy, pprint, enum, etc.

Mathematical : numbers, math, random, decimal, statistics, etc.

Files and Directories : pathlib, stat, glob, shutil, filinput, etc.

Data Persistence : pickle, dbm, sqlite3, etc.

Compression and Archiving : gzip, bz2, zipfile, tarfile, etc.

Concurrent Execution : threading, multiprocessing, sched, queue,  etc.

Networking : socket, ssl, asyncio, signal, etc.

Internet Data Handling : email, json, mailbox, mimetypes, binascii,  etc.

Internet Protocols : urllib, http, ftplib, smtplib, telnetlib, xmlrpc,  etc.

◘ In addition to the standard library, there is a growing collection of several  thousand modules ranging from individual modules to packages and entire  application development frameworks, available from the Python Package Index.


BloomingBud: nice
Similar questions
Math, 5 months ago