Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #EX2
- ch1=input("donner une chaine :")
- chtmp=ch1
- ch2=input('donner la chaine a chercher dans la premiere chaine :')
- i=0
- while True:
- pos0=ch1.find(ch2)
- if pos0!=-1:
- i+=1
- pos0=ch1.find(ch2)
- pos0=pos0+len(ch2)
- ch1=ch1[pos0:]
- else:
- # print("n'existe pas !")
- break
- ch='Occurrence de "%s" dans "%s" est %d' %(ch2,chtmp,i)
- ch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement