« Python : Les index des chaînes de caractères » : différence entre les versions

De www.yakakliker.org
(Page créée avec « <syntaxhighlight lang="python3"> chaine = 'Une chaine' print(chaine[0]) # U print(chaine[1]) # n print(chaine[2]) # e </syntaxhighlight><syntaxhighlight lang="python3"> chaine = 'Une chaine' print(chaine[4:8]) # chai </syntaxhighlight><syntaxhighlight lang="python3"> chaine = 'Une chaine' print(chaine[:-1]) # Une chain print(chaine[4:]) # chaine </syntaxhighlight><syntaxhighlight lang="python3"> chaine = 'Une chaine' print(chaine[2:-1:2]) # ecan print(c... »)
 
Aucun résumé des modifications
 
(Une version intermédiaire par le même utilisateur non affichée)
Ligne 20 : Ligne 20 :
[[Catégorie:Python]]
[[Catégorie:Python]]
[[Catégorie:Scripts]]
[[Catégorie:Scripts]]
‎<html>
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
  kofiWidgetOverlay.draw('yakakliker', {
    'type': 'floating-chat',
    'floating-chat.donateButton.text': 'Café',
    'floating-chat.donateButton.background-color': '#00b9fe',
    'floating-chat.donateButton.text-color': '#fff'
  });
</script>
‎</html>
‎<html>
<a href="https://www.compteurdevisite.com" title="compteur web gratuit sans pub"><img src="https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx" border="0" title="compteur web gratuit sans pub" alt="compteur web gratuit sans pub"></a>
‎</html>

Dernière version du 17 février 2025 à 18:19

chaine = 'Une chaine'
print(chaine[0])  #  U
print(chaine[1])  #  n
print(chaine[2])  #  e
chaine = 'Une chaine'
print(chaine[4:8])  # chai
chaine = 'Une chaine'
print(chaine[:-1])  # Une chain
print(chaine[4:])  # chaine
chaine = 'Une chaine'
print(chaine[2:-1:2])  # ecan
print(chaine[2:-1:3])  # ehn


compteur web gratuit sans pub