Flat 10% & upto 50% off + 10% Cashback + Free additional Courses. Hurry up
  • Live Instructor-led Classes
  • Expert Education
  • 24*7 Support
  • Flexible Schedule


Python string is an ordered collection of characters which is used to represent and store the text-based information. Strings are stored as individual characters in a contiguous memory location. It can be accessed from both the directions in forward and backward.

It can be accessed from both the directions in forward and backward. Forward indexing start form 1,2,3.. Whereas backward indexing start form -1,-2,-3….

For e.g.

Name = "Hello intellipaat"

print Name[1]




Strings Operators

There are 3 types of operators are supported by string which are –

  1. Basic Operators  (+, *)
  2. Relational Operators (<,><=,>=,==,!=,)
  3. Membership Operators (in, not in)


Table: Common String Constants and Operations

Operators  Description
s1 = ‘ ‘ Empty string
s2 = “spam” Double quotes
block = “”” … “”” Triple-quoted blocks
s1 + s2 Concatenate
s2 * 3 repeat
s2[i], Index
s2[i:j], slice
len(s2) length
“a %s parrot” % ‘dead’ String formatting
for x in s2, Iteration,
‘m’ in s2 membership


Table:  String Backslash Characters

 Operators Description
\newline Ignored (a continuation)
\n Newline (linefeed)
\\ Backslash (keeps one \)
\v Vertical tab
\’ Single quote (keeps ‘)
\t Horizontal tab
\” Double quote (keeps “)
\r Carriage return
\a Bell
\f Form feed
\b Backspace
\0XX Octal value XX
\e Escape (usually)
\xXX Hex value XX
\000 Null (doesn’t end string)


Example – Program to concatenate two strings

S1 = "hello"

S2 = "Intellipaat"

print S1 + S2

Learn more about PYTHON TOOLKIT in this insightful blog now!

Previous Next

Download Interview Questions asked by top MNCs in 2018?

Learn SQL in 16 hrs from experts

"0 Responses on Python Strings"

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

Sales Offer

Sign Up or Login to view the Free Python Strings.