When using f-string formatting, you can specify a field width when printing strings
print(f’Hello world, my name is {name:10}’)
You can add an align character, before the field width, to set the position of the sting.
You can add a fill character, before the align character, to fill up empty space (default is space)
Set floating-point precision by adding a :.#f after a floating-point variable, where # is the number of decimal places
Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Sur cette page du site, vous pouvez voir la vidéo en ligne Python - String Formatting using F-String Tutorial with Examples durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Appficial 31 octobre 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 4,759 fois et il a aimé 57 téléspectateurs. Bon visionnage!