+ 1
Why use the "{0}" .format("something") rather than " %s " % "something" ??
I don't really understand the benefit of "{0} {1} ". format(list1[0], list2[1]), I find the use of %s or %d easier to understand, could someone explain the advantages of using the .format method please? thank you in advance :)
1 Answer
+ 6
One advantage of using format is that values to be formatted can be used multiple times and out of order:
'{0} {1} {0} that is the question'.format(
'to be', 'or not')