Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.python > #3434
| From | Benoit Izac <use.reply.to@INVALID.ADDRESS> |
|---|---|
| Newsgroups | fr.comp.lang.python |
| Subject | Re: Débutant. Formatage de input. Python 3.8 |
| Date | 2021-01-03 08:40 +0100 |
| Message-ID | <87sg7ieade.fsf@izac.org> (permalink) |
| References | <rsrglk$fe4$1@gioia.aioe.org> |
Bonjour,
Le 03/01/2021 à 05:20, Dominique a écrit dans le message
<rsrglk$fe4$1@gioia.aioe.org> :
> Je crois me souvenir qu'il y a un formatage particulier d'input qui
> permet d'introduire des paramètre du style :
>
> input('Donnez la valeur n°{x}')
>
> Sachant que {x} est, par exemple, un élément de for x in range(1,10)
Oui, ça s'appelle les f-strings, ça a été introduit avec la version 3.6
de Python :
<https://docs.python.org/fr/3/tutorial/inputoutput.html#formatted-string-literals>
input(f'Donnez la valeur n°{x}')
NB : Ce n'est pas spécifique à input().
--
Benoit Izac
Back to fr.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Débutant. Formatage de input. Python 3.8 Dominique <zzz@aol.com.invalid> - 2021-01-03 05:20 +0100
Re: Débutant. Formatage de input. Python 3.8 Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2021-01-03 08:40 +0100
Re: Débutant. Formatage de input. Python 3.8 Dominique <zzz@aol.com.invalid> - 2021-01-03 11:44 +0100
csiph-web