Trouver en python dans la chaîne de

Exemples de code

61
0

trouver la chaîne dans une chaîne de python

>>> str = "Messi is the best soccer player"
>>> "soccer" in str
True
>>> "football" in str
False
0
0

python chaîne de trouver

The find() method returns the index of first occurrence of the substring
(if found). If not found, it returns -1.
message = 'Python is a fun programming language'

# check the index of 'fun'
print(message.find('fun'))

# Output: 12

Pages connexes

Pages d'exemples similaires

Dans d'autres langues

Cette page est dans d'autres langues

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................