- 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
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
4K+ Views
The multiprocessing package supports spawning processes. It refers to a function that loads and executes a new child processes. For the child to terminate or to continue executing concurrent computing, then the current process hasto wait using an API, which is similar to threading module.IntroductionWhen we work with Multiprocessing, at first we create process object. Then it calls a start() method.Example codefrom multiprocessing import Process def display(): print ('Hi !! I am Python') if __name__ == '__main__': p = Process(target=display) p.start() p.join()In this example, ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
131 Views
Before using Tweet in Python, we have to follow some steps. Step1 − at first we must have a tweeter profile and then it has to be added with our mobile number. First go to - Settings -> Add Phone -> Add number -> Confirm -> Save. We have to follow these steps. Then turn off all text notifications. Step2 − Set up a new app. Follow − Twitter Apps -> Create New App -> Leave Callback URL empty -> Create Twitter application. Then display message "Your application has been created. You review and adjust your application's settings". Step3 − ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
587 Views
Synchronization between processesMultiprocessing is a package which supports spawning processes using an API. This package is used for both local and remote concurrencies. Using this module, programmer can use multiple processors on a given machine. It runs on Windows and UNIX os.All equivalent synchronization primitives are present in this package.Example codefrom multiprocessing import Process, Lock def my_function(x, y): x.acquire() print ('hello world', y) x.release() if __name__ == '__main__': lock = Lock() for num in range(10): Process(target= my_function, args=(lock, num)).start()Here one instance can lock ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
254 Views
In Python provides SunPy package for create solar image. In this package has different files which are solar data of proton/electron fluxes from various solar observatory and solar labs. Using pip install sunpy command, we can install sunpy package. Here we plot a sample AIA image. AIA is Atmospheric Imaging Assembly. This is another instrument board of the SDO. Here we use sunpy.Map() function to create a map from one of the supported data products. Example code import sunpy.map import matplotlib.pyplot as plt import sunpy.data.sample my_aia = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) fig = plt.figure() ax = plt.subplot(111, projection=my_aia) my_aia.plot() my_aia.draw_limb() ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
524 Views
For solving this problem we need requests module.For installing requests module, we need this command to get executed at command line.pip install requestsScrapingImport requests module.Then we need to fetch data from URL.Using UTF-8 decode the text.Then convert string into a list of words.Ordered FindingTraverse the list of words using loop.Then compare the ASCII value of adjacent character of each word.If the comparison is true then print ordered word otherwise store the unordered word.Example codeimport requests def Words_find(): my_url = ""#put thisurl of .txt files in any website my_fetchData = requests.get(my_url) ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
143 Views
Here one dictionary is given, our task is to sort by their values. Two values are present in this dictionary one is name and another is roll. First we display sorted list by their roll using lambda function and in-built sorted function. Second we display sorted list by the name and roll and third by their name. Example code Live Demo # Initializing list of dictionaries my_list1 = [{ "name" : "Adwaita", "roll" : 100}, { "name" : "Aadrika", "roll" : 234 }, { "name" : "Sakya" , "roll" : 23 }] print ("The list is sorted ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
14K+ Views
We can easily perform matrix manipulation in Python using the Numpy library. NumPy is a Python package. It stands for 'Numerical Python'. It is a library consisting of multidimensional array objects and a collection of routines for processing of array. Using NumPy, mathematical and logical operations on arrays can be performed. Install and Import Numpy To install Numpy, use pip − pip install numpy Import Numpy − import numpy Add, Subtract, Divide and Multiply matrices We will use the following Numpy methods for matrix manipulations − numpy.add() − Add two matrices numpy.subtract() − Subtract two matrices numpy.divide() ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
533 Views
In Python in some cases we use Single Underscore(_) and some cases we use Double Underscores (__). In Python has following cases, where we use underscore. If we want to store the value of last expression in interpreter. If we want to ignore some values. For declaration of variable or function. To separate digits of number lateral value. It is also used as ‘Internationalization (i18n)’ or ‘Localization (l10n)’ functions. Now some examples on every cases. Used in interpreter The Python Interpreter stores the last expression value in the '_'. >>> 20 20 >>> _ ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
1K+ Views
First we need to know what a prime number is.A prime number always a positive integer number and divisible by exactly 2 integers (1 and the number itself), 1 is not a prime number.Now we shall discuss some methods to find Prime Number.Method1Using For loopsExampledef primemethod1(number): # Initialize a list my_primes = [] for pr in range(2, number): isPrime = True for i in range(2, pr): if pr % i == 0: isPrime = False if isPrime: my_primes.append(pr) print(my_primes) primemethod1(50)Output[2, 3, 5, 7, 11, ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
4K+ Views
The PageRank algorithm is applicable in web pages. Web page is a directed graph, we know that the two components of Directed graphsare -nodes and connections. The pages are nodes and hyperlinks are the connections, the connection between two nodes.We can find out the importance of each page by the PageRank and it is accurate. The value of the PageRank is the probability will be between 0 and 1.The PageRank value of individual node in a graph depends on the PageRank value of all the nodes which connect to it and those nodes are cyclically connected to the nodes whose ... Read More