In this video you will learn about string slicing and case methods of string.
Python provides many ways to fetch substring from a string. It is called ‘slicing’.
It follows this syntax:
string[start: end: step]
Where,
start: The starting index of the substring. The character at this index is included in the substring. If start is not included, it is assumed to equal to 0.
end: The terminating index of the substring. The character at this index is NOT included in the substring. If end is not included, or if the specified value exceeds the string length, it is assumed to be equal to the length of the string by default.
step: Every ‘step’ character after the current character to be included. The default value is 1. If the step value is omitted, it is assumed to equal to 1.
Examples
string[start:end]: Get all characters from index start to end-1
string[:end]: Get all characters from the beginning of the string to end-1
string[start:]: Get all characters from index start to the end of the string
string[start:end:step]: Get all characters from start to end-1 except every step character
#python_video_22 #tarunsir #string #python #python3
On this page of the site you can watch the video online string in python | substring and case methods with a duration of hours minute second in good quality, which was uploaded by the user Tarun Sir 18 October 2019, share the link with friends and acquaintances, this video has already been watched 299 times on youtube and it was liked by 13 viewers. Enjoy your viewing!