Exemple de recherche des sous-chaînes dans un ‘string’

Author:


{filelink=16364}


strRech ="Apprendre à programmer avec des exemples de python"
         " sur python.mesexemples.com"

# trouver les index des certains caractère dans la chaîne
print strRech.find("à") #10
print strRech.rfind("a")#24
print strRech.find("de")#29
print strRech.find("python")#45
print strRech.index("exemple")#33
print strRech.index("a",15)#18
print strRech.rindex(".")#74
print strRech.rindex("p",1,18)#13

Livres Sur ce Sujet

[amazon_image id=”2212134347″ link=”true” target=”_blank” size=”medium” ]Apprendre à programmer avec Python 3[/amazon_image] [amazon_image id=”B005J2L260″ link=”true” target=”_blank” size=”medium” ]Apprenez à programmer en Python[/amazon_image] [amazon_image id=”2100508830″ link=”true” target=”_blank” size=”medium” ]Python : Petit guide à l’usage du développeur agile[/amazon_image] [amazon_image id=”2212127081″ link=”true” target=”_blank” size=”medium” ]Apprendre à programmer avec Python 3 : Avec plus de 50 pages de corigés d’exercices ![/amazon_image]

Leave a Reply

Your email address will not be published. Required fields are marked *