- 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
![Pranav Indukuri](https://www.tutorialspoint.com/assets/profiles/512605/profile/60_2168928-1662357840.jpeg)
2K+ Views
List is one of the most commonly used data structures provided by python. List is a data structure in python that is mutable and has an ordered sequence of elements. Following is a list of integer values − Example Following is a list of integer values. lis= [12, 22, 32, 54, 15] print(lis) Output If you execute the above snippet, it produces the following output. [12, 22, 32, 54, 15] In this article, we will look at different ways to find the minimum of the list in Python. For the above list, the minimum element of the list ... Read More
![Pranav Indukuri](https://www.tutorialspoint.com/assets/profiles/512605/profile/60_2168928-1662357840.jpeg)
9K+ Views
List is one of the most commonly used data structures provided by python. List is a data structure in Python that is mutable and has an ordered sequence of elements. Following is a list of integer values Example Following is a list of integer values. lis= [1, 2, 3, 4, 5] print(lis) Output If you execute the above snippet, it produces the following output. [1, 2, 3, 4, 5] In this article, we will look at different ways to find the maximum of the list in Python. For the above list, the maximum element of the list is ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
2K+ Views
Character classA "character class", or a "character set", is a set of characters put in square brackets. The regex engine matches only one out of several characters in the character class or character set. We place the characters we want to match between square brackets. If you want to match any vowel, we use the character set [aeiou].A character class or set matches only a single character. The order of the characters inside a character class or set does not matter. The results are identical.We use a hyphen inside a character class to specify a range of characters. [0-9] matches ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/7345/profile/60_93814-1511173378.jpg)
566 Views
You can import any built-in module while writing Python script using TutorialsPoint's online IDE. For example you can import time, sys, os, re modules. However, the modules that are not bundled with the distribution - the one which needs to be installed using package managers like pip or conda - can not be imported.
![Ali](https://www.tutorialspoint.com/assets/profiles/14292/profile/60_101553-1513052445.jpg)
2K+ Views
Dynamically typedDynamically typed language is called so because the type is associated with run-time values. You don’t have to specify types every time. As the name suggests, variables' types are dynamic, means even after you set a variable to a type you can change it.Some dynamically typed languages include Python, Perl, Ruby, etc.UntypedUntyped languages, also known as dynamically typed languages, are programming languages that do not make you define the type of a variable.JavaScript is untyped language. This means that a JavaScript variable can hold a value of any data type. To declare variables in JavaScript, you need to use the ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
383 Views
* An asterisk meta-character in a regular expression indicates 0 or more occurrences of the pattern to its leftThe following code matches and prints the zero or more occurrences of the pattern '\w' in the string 'chihua huahua'Exampleimport re s = 'chihua huahua' result = re.findall(r'\w*', s) print resultOutputThis gives the output['chihua', '', 'huahua', '']
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
67 Views
The following code replaces all the characters from given string with ''Exampleimport re line = 'this is a text with in between and then there are instances ... where the number ranges from 0-99.\ and there are many other lines in the text files \ with such tags ' line = re.sub(r"", "", line) print lineOutputThis gives the outputthis is a text with in between and then there are instances ... where the number ranges from 0-99.and there are many other lines in the text files with such tags
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
466 Views
The word boundary \b matches positions where one side is a word character (usually a letter, digit or underscore)\B matches all positions where \b doesn't match.The following code shows how regexpr \B worksimport re result = re.findall(r'\Bcat', 'certificate') result2 = re.findall(r'\Bcat', 'tomcat') result3 = re.findall(r'\Bcat', 'catfish') print result, result2,result3This gives the output['cat'] ['cat'] []
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
3K+ Views
When you use match and search methods of module re, if there is a match, it has bool value of True and if there is no match, you get None that has a bool value of False.Match objects are always true, and None is returned if there is no match>>> bool(re.search("def", "abcdefgh")) True >>> bool(re.search("rest", "pqrstuv")) False
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
2K+ Views
Regular expressions are an essential tool for searching and manipulating strings in Python. Among the various patterns and techniques available, the [d+] expression is particularly useful for matching one or more digits in a string. In this article, we will explore the [d+] regular expression pattern, its usage, and provide five code examples with step−by−step explanations to help you understand and apply this concept in your Python projects. Before diving into the code examples, let's first understand the [d+] pattern. [d+] is a combination of two elements: [d]: This is a shorthand character class for the digits 0 to 9. ... Read More