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
Sur cette page du site, vous pouvez voir la vidéo en ligne string in python | substring and case methods durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Tarun Sir 18 octobre 2019, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 299 fois et il a aimé 13 téléspectateurs. Bon visionnage!