- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 10784 Articles for Python
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
12K+ 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
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
492 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
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
460 Views
About Linear RegressionSimple Linear Regression BasicsAllows us to understand relationship between two continuous variable.Example −x = independent variableweighty = dependent variableheighty = αx + βLet's understand simple linear regression through a program −#Simple linear regression import numpy as np import matplotlib.pyplot as plt np.random.seed(1) n = 70 x = np.random.randn(n) y = x * np.random.randn(n) colors = np.random.rand(n) plt.plot(np.unique(x), np.poly1d(np.polyfit(x, y, 1))(np.unique(x))) plt.scatter(x, y, c = colors, alpha = 0.5) plt.show()OutputPurpose of Linear Regression:to Minimize the distance between the points and the line (y = αx + β)AdjustingCoefficient: αIntercept/Bias: βBuilding a Linear Regression Model with PyTorchLet's ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
153 Views
We are going to cover some useful python tricks and tips that will come handy when you are writing program in competitive programming or for your company as they reduce the code and optimized execution. Get n largest elements in a list using the module heapq Example import heapq marks = [91, 67, 34, 56, 78, 99, 87, 23, 78, 66] print("Marks = ", marks) print("Largest =", heapq.nlargest(2, marks)) Output Marks = [91, 67, 34, 56, 78, 99, 87, 23, 78, 66] Largest = [99, 91] Get n smallest elements in a list using the ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
7K+ Views
Image Processing Using OpenCVOpenCV(Open source computer vision) is an open source programming library basically developed for machine learning and computer vision. It provides common infrastructure to work on computer vision applications and to fasten the use of machine learning in commercial products.With more than 2.5 thousand optimized algorithms for both computer vision and machine learning are both classic and state-of-the-art algorithms. With so many algorithms, makes it to use the library for multiple purposes including face detection & recognization, identify objects, classify human actions in videos, track camera movements, join images together to produce a high resolution image of an ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
269 Views
OpenCV(Open source computer vision) is an open source programming library basically developed for machine learning and computer vision. It provides common infrastructure to work on computer vision applications and to fasten the use of machine learning in commercial products.With more than 2.5 thousand optimized algorithms for both computer vision and machine learning are both classic and state-of-the-art algorithms. With so many algorithms, makes it to use the library for multiple purposes including face detection & reorganization, identify objects, classify human actions in videos, track camera movements, join images together to produce a high resolution image of an entire scene and ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
3K+ Views
The winsound module is specific to Python installation on Windows operating system. The module defines following functions −Beep()When this function is called a beep is heard from the PC’s speaker. The function needs two parameters. The frequency parameter specifies frequency of the sound, and must be in the range 37 through 32, 767 hertz. The duration parameter specifies duration of sound in .>>> import winsound >>> winsound.Beep(1000, 500)MessageBeep()This function plays a sound as specified in the registry. The type argument specifies which sound to play. Possible values are −-1, MB_ICONASTERISK, MB_ICONEXCLAMATION, MB_ICONHAND, MB_ICONQUESTION, and MB_OK (default).The value -1 produces a ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
21K+ Views
The wave module in Python's standard library is an easy interface to the audio WAV format. The functions in this module can write audio data in raw format to a file like object and read the attributes of a WAV file.The file is opened in 'write' or read mode just as with built-in open() function, but with open() function in wave modulewave.open()This function opens a file to read/write audio data. The function needs two parameters - first the file name and second the mode. The mode can be 'wb' for writing audio data or 'rb' for reading.obj = wave.open('sound.wav', 'wb')A ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
432 Views
Indentation is an important feature of Python syntax. Code blocks in function, class or loops are required to follow same indent level for statements in it. The tabnanny module in Python's standard library is able to detect any violation in this stipulation.This module is primarily intended to be used in command line mode with –m switch. However, it can also be imported in an interpreter session.Command line usagepython –m tabnanny –q example.pyFor verbose output use –v switchpython –m tabnanny –v example.pyFollowing functions are defined in tabnanny module for checking indentation programmatically.check()This function checks for ambiguously indented lines in a given ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
430 Views
Configuration information of Python's installation can be accessed by the sysconfig module. For example the list of installation paths and the configuration variables specific to the installation platform.The sysconfig module provides the following functions to access Configuration variablessysconfig.get_config_vars()With no arguments, this function returns a dictionary of all configuration variables relevant for the current platform.>>> import sysconfig >>> sysconfig.get_config_vars() {'prefix': 'E:\python37', 'exec_prefix': 'E:\python37', 'py_version': '3.7.2', 'py_version_short': '3.7', 'py_version_nodot': '37', 'installed_base': 'E:\python37', 'base': 'E:\python37', 'installed_platbase': 'E:\python37', 'platbase': 'E:\python37', 'projectbase': 'E:\python37', 'abiflags': '', 'LIBDEST': 'E:\python37\Lib', 'BINLIBDEST': 'E:\python37\Lib', 'INCLUDEPY': 'E:\python37\Include', 'EXT_SUFFIX': '.pyd', 'EXE': '.exe', 'VERSION': '37', 'BINDIR': 'E:\python37', 'SO': '.pyd', 'userbase': 'C:\Users\acer\AppData\Roaming\Python', 'srcdir': 'E:\python37'}With ... Read More