+ 1
String formatting
# string formatting nums = [4, 5, 6] msg = "Numbers: {} {} {}". format(nums[0], nums[1], nums[2]) print(msg) output: Numbers: 4 5 6
1 Réponse
+ 2
Yea, I know but what are the differences compare to below program
# string formatting
nums = [4, 5, 6]
msg = "Numbers: {0} {1} {2}". format(nums[0], nums[1], nums[2])
print(msg)