Concaténation ou assemblage des chaînes de caractères en python

Author:

 list, list
{filelink=16528}


import sys

mot1="J'aime"
mot2="Programmer"
mot3="avec python"
listMots = ["Apprendre", "à", "programmer", "en", "python"]

#Assemblage simple
print "Mes Mots: "+mot1+' '+mot2+' '+mot3
print "Ma Liste: "+' '.join(listMots)

#Assemblage avec paramètres
chaine=("Chaîne formatée: %s %s %s "%(mot1,mot2,mot3))
print chaine

########## Ce module affiche ###############

# Mes Mots: J'aime Programmer avec python
# Ma Liste: Apprendre à programmer en python
# Chaîne formatée: J'aime Programmer avec python

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 *