+ 1

what is the use of string formatting in python

8th May 2020, 12:43 PM
srinu
srinu - avatar
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
8th May 2020, 12:48 PM
Slick
Slick - avatar
+ 1
Its primary use is for substitution and assignments
8th May 2020, 12:48 PM
James Clark I. Vinarao
James Clark I. Vinarao - avatar