Webbrowser Module

Webbrowser Module is used to manage the different URLs of web browsers and perform different functions associated with these URLs. Learn more about this module here. Parameter Details webbrowser.open()url the URL to open in the web browsernew 0 opens the URL in the existing tab, 1 opens in a new window, 2 opens in new … Read more

Functools Module

python

Functools Module help in managing the applications and different functions in Python language and you can learn it easily. Find out how. Functools Module: partial The partial function creates partial function application from another function. It is used to bind values to some of the function’s arguments (or keyword arguments) and produce a callable without … Read more

Deque Module

Deque Module Parameter DetailsCreates the deque with initial elements copied from another iterable.iterableLimits how large the deque can be, pushing out old elements as new are added.maxlen Basic deque using The main methods that are useful with this class are popleft and appendleft from collections import dequed = deque([1, 2, 3])p = d.popleft() # p … Read more

The base64 Module

python

The base64 ModuleParameter Description base64.b64encode(s, altchars=None)s A bytes-like objectA bytes-like object of length 2+ of characters to replace thealtchars ‘+’ and ‘=’ characters when creating the Base64 alphabet.Extra characters are ignored. base64.b64decode(s, altchars=None,validate=False)s A bytes-like objectA bytes-like object of length 2+ of characters to replace thealtchars ‘+’ and ‘=’ characters when creating the Base64 alphabet.Extra … Read more

Random module

python

Random Module is used to generate random things by applying random function code lines. Learn more about the Random module in python here. Random module: Creating a random user password In order to create a random user password we can use the symbols provided in the string module. Specifically punctuation for punctuation symbols, ascii_letters for … Read more

Asyncio Module

python

Before Python 3.5+ was released, the asyncio module used generators to mimic asynchronous calls and thus had a different syntax than the current Python 3.5 release. Asyncio Module: Coroutine and Delegation Syntax Before Python 3.5+ was released, the asyncio module used generators to mimic asynchronous calls and thus had a different syntax than the current … Read more

Queue Module

The Queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. There are three types of queues provides by queue module,Which are as following : 1. Queue 2. LifoQueue 3. PriorityQueue Exception which could be come: 1. Full (queue overflow) 2. Empty (queue … Read more

The dis module

The dis module Section 57.1: What is Python bytecode? Python is a hybrid interpreter. When running a program, it first assembles it into bytecode which can then be run in the Python interpreter (also called a Python virtual machine). The dis module in the standard library can be used to make the Python bytecode human-readable … Read more

Itertools Module

python

Itertools Module, itertools.combinations will return a generator of the k-combination sequence of a list. Learn More about it here. Combinations method in Itertools Module itertools.combinations will return a generator of the k-combination sequence of a list. In other words: It will return a generator of tuples of all the possible k-wise combinations of the input … Read more

The locale Module

The locale Module Currency Formatting US Dollars Using the locale Module import localelocale.setlocale(locale.LC_ALL, ”)Out[2]: ‘English_United States.1252’locale.currency(762559748.49)Out[3]: ‘$762559748.49’locale.currency(762559748.49, grouping=True)Out[4]: ‘$762,559,748.49’ Must Read Python Interview Questions 165+ Python Interview Questions & Answers 200+ Python Tutorials With Coding Examples Python Language Basics Tutorial Python String Representations of Class Instances Python For Beginners Tutorial Python Debugging Tutorial Python Data … Read more

The os Module

Python Tutorials

The os Module Parameter DetailsPath A path to a file. The path separator may be determined by .os.path.sepMode The desired permission, in octal (e.g. )0700 This module provides a portable way of using operating system dependent functionality. The os Module: makedirs – recursive directory creation Given a local directory with the following contents: └── dir1├── … Read more

Sqlite3 Module

Python Tutorials

The sqlite3 module was written by Gerhard Häring. To use the module, you must first create a Connection object that represents the database. Here the data will be stored in the example.db file: sqlite3 module – Not require separate server process The sqlite3 module was written by Gerhard Häring. To use the module, you must … Read more

JSON Module

python

JSON Module in Python is utilized by entering specific code lines and performing required functions. Learn More about this module here. JSON Module: Storing data in a file The following snippet encodes the data stored in d into JSON and stores it in a file (replace filename with the actual name of the file). import … Read more

Collections module

python

The built-in collections package provides several specialized, flexible collection types that are both high-performance and provide alternatives to the general collection types of dict, list, tuple and set. The Collections module also defines abstract base classes describing different types of collection functionality (such as MutableSet and ItemsView). Collections module: collections.Counter Counter is a dict sub … Read more

Operator module

Python Tutorials

Operator module In Python comes handy in many cases and it comprises upon specific code lines. Learn more about this module here. Operator module: Itemgetter Grouping the key-value pairs of a dictionary by the value with itemgetter: from itertools import groupbyfrom operator import itemgetteradict = {‘a’: 1, ‘b’: 5, ‘c’: 1}dict((i, dict(v)) for i, v … Read more

Complex math

python

Complex Math can be performed in Python easily for complex math functions. Learn more about complex match commands and codes here. Complex Math: Advanced complex arithmetic The module cmath includes additional functions to use complex numbers. import cmath This module can calculate the phase of a complex number, in radians: z = 2+3j # A … Read more

Math Module

python

Math Module: Rounding: round, floor, ceil, trunc In addition to the built-in round function, the math module provides the floor, ceil, and trunc functions. x = 1.55y = -1.55 round to the nearest integer round(x) # 2round(y) # -2 the second argument gives how many decimal places to round to (defaults to 0) round(x, 1) … Read more

Difference between Module and Package

Module and package are two different things used in Python Programming language. Both of these parameters shall be distinguished before performing actions. Module and package: Modules A module is a single Python file that can be imported. Using a module looks like this: module.py def hi():print(“Hello world!”) my_script.py import modulemodule.hi() in an interpreter from module … Read more

Importing modules in Python

Importing modules in Python can be done easily. import module will import a module and then allow you to reference its objects — values, functions and classes, for example — using the module.name syntax. In the above example, the random module is imported, which contains the randint function. So by importing random you can call … Read more