find method in python | String methods in python | Python Tutorials 2023

Publié le: 19 janvier 2024
sur la chaîne: ThingsYouMustKnow
63
1

find method in python

In Python, the find() method is a string method that is
used to find the index of the first occurrence of a substring
within a string. If the substring is not found, it returns -1.

Here's an example:

my_string="Hello World"
index=my_string.find("World")

In this example, the find("World") method will search
for the substring "World" in the my_string variable.
If it finds the substring, it will return the index at
which it starts. If the substring is not found, it will return -1.

Please watch Video...!!!


Sur cette page du site, vous pouvez voir la vidéo en ligne find method in python | String methods in python | Python Tutorials 2023 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur ThingsYouMustKnow 19 janvier 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 63 fois et il a aimé 1 téléspectateurs. Bon visionnage!