<개인공부> - IT/[Python]
Python f-strings (Keep updating)
Aggies '19
2020. 4. 4. 02:19
반응형
Python supports string formatting three different ways.
1. %-formatting
2. str.format()
3. f-strings
I have used str.format() to print data so fat but I change my mind after knowing f-strings formatting.
name = 'Ethan'
age = 32
print (f'My name is {name} and I am {age} years old.')
name = 'Ethan'
age = 32
print (f'My name is {name} and I am {age} years old.')
The f-strings formatting sytax is f 'string ... ... {variable} .... {variable} ....'
반응형