Formatação de strings com o método format

This commit is contained in:
Luiz Otávio
2022-10-25 11:14:19 -03:00
parent 49eafd2d70
commit 2bbc348218

9
aula14.py Normal file
View File

@@ -0,0 +1,9 @@
a = 'AAAAA'
b = 'BBBBBB'
c = 1.1
string = 'b={nome2} a={nome1} a={nome1} c={nome3:.2f}'
formato = string.format(
nome1=a, nome2=b, nome3=c
)
print(formato)