Introduction to Strings in Python

Last updated on Oct 28,2020 4.5K Views

Introduction to Strings in Python

edureka.co

In Python, Strings can be created by simply enclosing characters in quotes. Python does not support character types. These are treated as length-one strings, and are also considered as substrings. Substrings are immutable and can’t be changed once created.

Strings are the ordered blocks of text that are enclosed in single or double quotations. Thus, whatever is written in quotes, is considered as string. Though it can be written in single or double quotations, double quotation marks allow the user to extend strings over multiple lines without backslashes, which is usually the signal of continuation of an expression, e.g., ‘abc’, “ABC”.

Concatenation and Repetition

>>> ‘abc’+‘def’

‘abcdef’

>>> ‘abc’*3

‘abcabcabc’

Indexing and Slicing Operation

Built-in String Methods

Following are the built-in String Methods that can be used in Python:

Got a question for us? Mention them in the comments section and we will get back to you. 

Related Posts:

Introduction to Python for Big Data Analytics

Python for Big Data Analytics

Learn Python for Big Data Analytics

Upcoming Batches For Data Science with Python Certification Course
Course NameDateDetails
Data Science with Python Certification Course

Class Starts on 25th May,2024

25th May

SAT&SUN (Weekend Batch)
View Details
Data Science with Python Certification Course

Class Starts on 29th June,2024

29th June

SAT&SUN (Weekend Batch)
View Details
BROWSE COURSES
REGISTER FOR FREE WEBINAR Prompt Engineering Explained