- 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 34488 Articles for Programming
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
4K+ Views
Function in the 'trace' module in Python library generates trace of program execution, and annotated statement coverage. It also has functions to list functions called during run by generating caller relationships.Following two Python scripts are used as an example to demonstrate features of trace module.#myfunctions.py import math def area(x): a = math.pi*math.pow(x, 2) return a def factorial(x): if x==1: return 1 else: return x*factorial(x-1)#mymain.py import myfunctions def main(): x = 5 print ('area=', myfunctions.area(x)) ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
468 Views
The '_thread' module in Python library provides a low-level interface for working with light-weight processes having multiple threads sharing a global data space. For synchronization, simple locks (also called mutexes or binary semaphores) are defined in this module. The 'threading' built-in module provides a higher-level threading API built on top of this module.start_new_thread()This module-level function is used to open a new thread in the current process. The function takes a function object as an argument. This function gets invoked on successful creation of the new thread. The span of this function corresponds to the lifespan of the thread. The thread ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
261 Views
SQLite is an open source database and is serverless that needs no configuration. Entire database is a single disk file that can be placed anywhere in operating system's file system. SQLite commands are similar to standard SQL. SQLite is extensively used by applications such as browsers for internal data storage. It is also convenient data storage for embedded devices.Standard Python library has in built support for SQLite database connectivity. It contains sqlite3 module which is a DB-API V2 compliant module written by Gerhad Haring. It adheres to DB-API 2.0.The DB-API has been defined in accordance with PEP-249 to ensure similarity ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
892 Views
The 'socket' module in Python's standard library defines how server and client machines can communicate using socket endpoints on top of the operating system. The 'socket' API contains functions for both connection-oriented and connectionless network protocols.Socket is an end-point of a two-way communication link. It is characterized by IP address and the port number. Proper configuration of sockets on either ends is necessary so as to initiate a connection. This makes it possible to listen to incoming messages and then send the responses in a client-server environment.The socket() function in 'socket' module sets up a socket object.import socket obj = ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
505 Views
In addition to the modules and packages built in to the standard distribution of Python, large number of packages from third party developers are uploaded to Python package repository called Python Package Index (https://pypi.org/. To install packages from here, pip utility is needed. The pip tool is an independent project, but since Python 3.4, it has been bootstrapped in Python distribution.The ensurepip module provides support for bootstrapping pip in existing installation of Python. Normally user doesn't need to use it explicitly. If however, installation of pip is skipped in normal installation or virtual environment, it may be needed.Following command will ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
573 Views
The dataclasses is a new module added in Python's standard library since version 3.7. It defines @dataclass decorator that automatically generates constructor magic method __init__(), string representation method __repr__(), the __eq__() method which overloads == operator (and a few more) for a user defined class.The dataclass decorator has following signaturedataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False)All the arguments take a Boolean value indicating whether a respective magic method or methods will be automatically generated or not.The 'init' argument is True by default. It will automatically generate __init__() method for the class.Let us define Student class using dataclass decorator as followsfrom dataclasses ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
10K+ Views
The Extensible Markup Language (XML) is a markup language much like HTML. It is a portable and it is useful for handling small to medium amounts of data without using any SQL database.Python's standard library contains xml package. This package has ElementTree module. This is a simple and lightweight XML processor API.XML is a tree like hierarchical data format. The 'ElementTree' in this module treats the whole XML document as a tree. the 'Element' class represents a single node in this tree. Reading and writing operations on XML files are done on the ElementTree level. Interactions with a single XML ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
Python's standard library has 'smtplib' module which defines an SMTP client session object that can be used to send mail via Python program.A mail server is an application that handles and delivers e-mail over the internet. Outgoing mail servers implement SMTP, or Simple MailTransfer Protocol, servers which are an Internet standard for email transmission.Incoming mail servers come in two main varieties. POP3, or Post office protocol and IMAP, or Internet Message Access Protocol.smptlib.SMTP()functionThis function returns an object of SMTP class. It encapsulates and manages a connection to an SMTP or ESMTP server. Following arguments are defined in the signature of ... Read More
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
1K+ Views
We will see here how to display all tables inside a MySQL database using Java. You can use show command from MySQL to get all tables inside a MySQL database.Let’s say our database is ‘test’. The Java code is as follows to show all table names inside a database ‘test’.The Java code is as follows. Here, connection is established between MySQL and Java −import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import com.mysql.jdbc.Connection; import com.mysql.jdbc.DatabaseMetaData; public class GetAllTables { public static void main(String[] args) throws SQLException { Connection conn = null; try { ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
2K+ Views
Use the put() method to add elements to LinkedHashMap collection.First, let us create a LinkedHashMap −LinkedHashMap l = new LinkedHashMap();Now, add elements −l.put("1", "Jack"); l.put("2", "Tom"); l.put("3", "Jimmy"); l.put("4", "Morgan"); l.put("5", "Tim"); l.put("6", "Brad");The following is an example to add elements to LinkedHashMap collection −Example Live Demoimport java.util.LinkedHashMap; public class Demo { public static void main(String[] args) { LinkedHashMap l = new LinkedHashMap(); l.put("1", "Jack"); l.put("2", "Tom"); l.put("3", "Jimmy"); ... Read More