![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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 27104 Articles for Server Side Programming
![Pythonic](https://www.tutorialspoint.com/assets/profiles/15007/profile/60_156531-1514381552.jpg)
176 Views
Any built-in data type converted into its string representation by str() function >>> str(10) '10' >>> str(11.11) '11.11' >>> str(3+4j) '(3+4j)' >>> str([1,2,3]) '[1, 2, 3]' >>> str((1,2,3)) '(1, 2, 3)' >>> str({1:11, 2:22, 3:33}) '{1: 11, 2: 22, 3: 33}' For a user defined class to be converted to string representation, __str__() function needs to be defined in it. >>> class rectangle: def __init__(self): self.l=10 self.b=10 def __str__(self): return 'length={} breadth={}'.format(self.l, self.b) >>> r1=rect() >>> str(r1) 'length = 10 breadth = 10'
![Sarika Singh](https://www.tutorialspoint.com/assets/profiles/502778/profile/60_2211036-1660719373.jpg)
610 Views
Type conversion is the transformation of a Python data type into another data type. Implicit type conversion and explicit type conversion are the two basic categories of type conversion procedures in Python. We will cover the following topics in this article − Implicit Type Conversion in Python is carried out by the Python interpreter automatically. In Python, explicit type conversion must be performed directly by the programmer. Let's study more about these two approaches in depth and with some illustrations. Implicit Type conversions Implicit type conversion occurs when the Python interpreter automatically changes an object's data type without ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
295 Views
The following code splits given string by a period and a line break as followsExampleimport re s = """Hi. It's nice meeting you. My name is Jason.""" result = re.findall(r'[^\s\.][^\.]+', s) print resultOutputThis gives the following output['Hi', "It's nice meeting you", 'My name is Jason']
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
593 Views
Have you ever come across situations where you had to determine if a string starts or ends with a particular pattern in Python? If so, you don’t need to worry, for Python's regular expressions provide a solution in such cases. With the power of regex, you can easily check whether a string begins or concludes with a specific sequence of characters. In this comprehensive article, we will explore various code examples that demonstrate how to use Python's regex to accomplish this task effortlessly. Before taking a plunge into the examples, let's take a break and understand what regular expressions are ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
1K+ Views
Have you ever encountered a situation where you needed to compare strings in Python but wanted to ignore the differences in letter casing? Worry not, for Python provides straightforward solutions to achieve case−insensitive string comparisons. In this comprehensive guide, we will explore five different code examples, each showcasing a unique method for conducting case−insensitive string comparisons. So, let's dive in and discover the wonders of Python's string comparison versatility! Before we delve into the examples, let's briefly understand what a case−insensitive string comparison entails. When comparing strings, a case−insensitive approach treats uppercase and lowercase letters as equal, thereby disregarding the ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
8K+ Views
The manipulation of files in the domain of programming plays a decisive role in data processing and management. Developers find themselves equipped with robust tools to handle files and text effectively in Python which is a multipurpose and powerful language. Among the everyday tasks involving files, one crucial operation is the search and replacement of specific text patterns with desired content. There are multiple approaches to accomplish this task, ranging from simple string manipulation to the use of powerful regular expressions in Python. In this exhaustive article, we will explore a few practical code examples that demonstrate various techniques to ... Read More
![Jayashree](https://www.tutorialspoint.com/assets/profiles/15002/profile/60_183575-1514465925.jpg)
32K+ Views
In C, ++ and -- operators are called increment and decrement operators. They are unary operators needing only one operand. Hence ++ as well as -- operator can appear before or after the operand with same effect. That means both i++ and ++i will be equivalent.i=5; i++; printf("%d", i);and i=5 ++i; printf("%d", i);both will make i=6.However, when increment expression is used along with assignment operator, then operator precedence will come into picture. i=5; j=i++;In this case, precedence of = is higher than postfix ++. So, value of i is assigned to i before incrementing i. Here j becomes 5 and i becomes 6.i=5; ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
712 Views
In the vast realm of Python programming, regular expressions stand as essential tools for text processing and pattern matching, unlocking a plethora of possibilities for developers. Within Python's re module, two prominent functions, re.search() and re.match(), emerge as the veritable champions of pattern matching within strings. While both functions share the noble mission of pattern searching, they diverge in their behavior and method of execution. In this comprehensive and enlightening article, we embark on an illuminating journey, delving step-by-step into the intricacies of Python's re.search() and re.match() functions. With a few practical code examples and clear explanations, we aim to ... Read More