Strings and String manipulation

Unit 8 > Computer Science > Class 12 > Samacheer Kalvi - English Medium

Objectives


• Know how to process text. • Understanding various string functions in Python. • Know how to format Strings. • Know about String Slicing. • Know about Strings application in real world.

Summary


• String is a data type in python. • Strings are immutable, that means once you define string, it cannot be changed during execution. • Defining strings within triple quotes also allows creation of multiline strings. • In a String, python allocate an index value for its each character which is known as subscript. • The subscript can be positive or negative integer numbers. • Slice is a substring of a main string. • Stride is a third argument in slicing operation. • Escape sequences starts with a backslash and it can be interpreted differently. • The format( ) function used with strings is very versatile and powerful function used for formatting strings. • The ‘in’ and ‘not in’ operators can be used with strings to determine whether a string is present in another string.