“Introduction to string”
Week-5 , Lecture-1
• A string is a collection of
characters.
• Strings are used to use text in
python.
• In python string can be used in the following
ways:
– Using Single Quotes: ‘Welcome’
– Using Double Quotes: “Welcome”
– Using Triple Quotes: Triple quotes are used to
specify multiple line of strings.
for example:
‘’’ Hello everyone,
How are you all ?
Let’s play a game‘’’
Unicode String
• Unicode allows you to write the text in your
native language.
• A Unicode-enabled text editor is required.
• Python uses a prefix U or u with the string.
• For example:
• U”Unicode String”
String Formatting
• format() function is used.
• Syntax:
– format(value, format specifier)
< is used for left justify
> Is used for right justify
^ is used for centre alignment
Thank You

Strings are sequences of characters used.

  • 1.
  • 2.
    • A stringis a collection of characters. • Strings are used to use text in python.
  • 3.
    • In pythonstring can be used in the following ways: – Using Single Quotes: ‘Welcome’ – Using Double Quotes: “Welcome” – Using Triple Quotes: Triple quotes are used to specify multiple line of strings. for example: ‘’’ Hello everyone, How are you all ? Let’s play a game‘’’
  • 4.
    Unicode String • Unicodeallows you to write the text in your native language. • A Unicode-enabled text editor is required. • Python uses a prefix U or u with the string. • For example: • U”Unicode String”
  • 5.
    String Formatting • format()function is used. • Syntax: – format(value, format specifier) < is used for left justify > Is used for right justify ^ is used for centre alignment
  • 6.