+ 1
what is the use of string formatting in python
4 Antworten
+ 2
Easier to read code
a = 24
b = 'dragons'
print('There are ' + str(a) + b)
print(f'There are {a} {b}')
both print statements print the same thing. One is way easier to read
+ 1
Its primary use is for substitution and assignments