Flat 10% & up to 50% off + Free additional Courses. Hurry up!

Python Strings


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!

"0 Responses on Python Strings"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

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


Sales Offer

  • To avail this offer, enroll before 23rd October 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer


Sign Up or Login to view the Free Python Strings.