Is it more Pythonic to use String Formatting over String Concatenation in Python 3?
问题 So I'm programming a text game in Python 3.4 that requires the use of the print() function very often to display variables to the user. The two ways I've always done this is with string formatting and string concatenation : print('{} has {} health left.'.format(player, health)) And, print(player + ' has ' + str(health) + ' health left.') So which is better? They're both equally as readable and quick to type, and perform exactly the same. Which one is more Pythonic and why? Question asked as I