Loading Events

« All Events

  • This event has passed.

Python String

April 22 @ 8:00 am - 5:00 pm

What is String?

  • String is a collection of alphabets, words or other characters. It is one of the primitive data structures and are the building blocks for data manipulation. Python has a built-in string class named str . Python strings are “immutable” which means they cannot be changed after they are created.

Create with Single quotes: 

  • String1 = ‘Welcome to the Reviving India’
    print(String1)
    print(type(String1))

Double quotes:

  • String1 = “Welcome to the Reviving India”
    print(String1)
    print(type(String1))

Triple quotes:

  • String1 = ”’Python Tutorial”’
    String2 = “”” Hello world”””
    print(String1,String2)
    print(type(String1),type(String2))

Read or Access String

  • Complete String
  • Single substring
  • Multiple substring

Example:

  • String1 = ‘Welcome to the Reviving India’
  • print(String1)   #Complete String
  • print(String1[0]) #Ist substring
  • print(String1[-1]) #Last substring
  • print(String1[0:5]) #Mutiple substring

Update

  • Updating of substring from a String is not allowed.
  • This will cause an error because item assignment from a String is not supported

Insert

  • Inserting of substring from a String is not allowed.
  • This will cause an error because item assignment from a String is not supported.
  • But we can achieve this through string concatenation (c = a+b)

Delete

  • Deletion of entire string is possible with the use of del keyword but deletion of characters from a String is not allowed
  • del <string_name>

Click here to  Watch the video

 

Details

Date:
April 22
Time:
8:00 am - 5:00 pm

Organizer

cocas

Venue

RevivingIndia
Meena bazar
Patna, 800007 India
+ Google Map
Phone
9716817710
View Venue Website