
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10476 Articles for Python

1K+ Views
Keywords in Python are reserved words. You cannot use them as variable name, function name, class name, etc. Following are the Keywords in Python − Keywords in Python FALSE await else import pass None break except in raise TRUE class finally is return and continue for lambda try as def from nonlocal while assert del global not with async ... Read More

1K+ Views
The binascii module enables conversion between binary and various ASCII encoded binary representations. The binascii module contains low-level functions written in C for greater speed. They are used by the higher-level modules such as uu, base64 or binhex modules.The binascii module defines the following functions. These function are named as a2b_* or b2a_*binascii.a2b_uu(string): Convert a single line of uuencoded data back to binary and return the binary data. Lines normally contain 45 (binary) bytes, except for the last line. Line data may be followed by white space.binascii.b2a_uu(data): Convert binary data to a line of ASCII characters, the return value is the converted ... Read More

611 Views
The binhex module encodes and decodes files in binhex4 format. This format is used in the representation of Macintosh files in ASCII. Only the data fork is handled.The binhex module defines the following functions −binhex.binhex(input, output): Convert a binary file with filename input to binhex file output. The output parameter can either be a filename or a file-like object (any object supporting a write() and close() method).binhex.hexbin(input, output): Decode a binhex file input. input may be a filename or a file-like object supporting read() and close() methods. The resulting file is written to a file named output unless the argument is None ... Read More

1K+ Views
Context variable can have different values depending on its context. Unlike Thread-Local Storage where each execution thread may have a different value for a variable, a context variable may be several contexts in one execution thread. This is useful in keeping track of variables in concurrent asynchronous tasks.The ContextVar class is used to declare and work with Context Variables.import contextvars name = contextvars.ContextVar("name", default = 'Hello')The optional default parameter is returned by ContextVar.get() when no value for the variable is found in the current context.name: The name of the variable. This is a read-only property.Following methods are defined in ContextVar ... Read More

275 Views
The dbm package in Python's built-in library provides a dictionary like an interface DBM style databases. The dbm library is a simple database engine, written by Ken Thompson. DBM stands for DataBase Manager, used by UNIX operating system, the library stores arbitrary data by use of a single key (a primary key) in fixed-size buckets and uses hashing techniques to enable fast retrieval of the data by key.There are following modules in dbm package −The dbm.ndbm module provides an interface to the Unix “(n)dbm” library. Dbm objects behave like dictionaries, with keys and values should be stored as bytes. The ... Read More

2K+ Views
Files with '.plist' the extension is used by Mac OS X applications to store application properties. The plislib module provides an interface to read/write operations of these property list files.The plist file format serializes basic object types, like dictionaries, lists, numbers, and strings. Usually, the top level object is a dictionary. To write out and to parse a plist file, use the dump() and load() functions. Serialized byte strings are handled by use dumps() and loads() functions. Values can be strings, integers, floats, booleans, tuples, lists, dictionaries (but only with string keys).This module defines the following functions −load()Read a plist ... Read More

726 Views
Functions in this module provide usefule information about live objects such as modules, classes, methods, functions, code objects etc. These functions perform type checking, retrieve source code, inspect classes and functions, and examine the interpreter stack.getmembers()− This function returns all the members of an object in a list of name, value pairs sorted by name. If the optional predicate is supplied, only members for which the predicate returns a true value are included. getmodulename() −This function returns the name of the module named by the file path, without including the names of enclosing packagesWe shall be using following script for ... Read More

305 Views
Python provides multiple libraries for image processing including Pillow, Python Imaging library, scikit-image or OpenCV.We are going to use Pillow library for image processing here as it offers multiple standard procedures for image manipulation and supports the range of image file formats such as jpeg, png, gif, tiff, bmp and others.Pillow library is built on top of Python Imaging Library(PIL) and provides more features than its parent library(PIL).InstallationWe can install pillow using pip, so just type following in the command terminal −$ pip install pillowBasic operation on a pillowLet’s some basic operation on images using pillow library.from PIL import Image ... Read More

14K+ Views
The configparser module from Python's standard library defines functionality for reading and writing configuration files as used by Microsoft Windows OS. Such files usually have .INI extension.The INI file consists of sections, each led by a [section] header. Between square brackets, we can put the section’s name. Section is followed by key/value entries separated by = or : character. It may include comments, prefixed by # or ; symbol. A sample INI file is shown below −[Settings] # Set detailed log for additional debugging info DetailedLog=1 RunStatus=1 StatusPort=6090 StatusRefresh=10 Archive=1 # Sets the location of the MV_FTP log file LogFile=/opt/ecs/mvuser/MV_IPTel/log/MV_IPTel.log ... Read More

625 Views
Web scraping not only excite the data science enthusiasts but to the students or a learner, who wants to dig deeper into websites. Python provides many webscraping libraries including, ScrapyUrllibBeautifulSoupSeleniumPython RequestsLXMLWe’ll discuss the lxml library of python to scrape data from a webpage, which is built on top of the libxml2 XML parsing library written in C, which helps make it faster than Beautiful Soup but also harder to install on some computers, specifically Windows.Installing and importing lxmllxml can be installed from command line using pip, pip install lxmlorconda install -c anaconda lxmlOnce lxml installation is complete, import the html ... Read More