+ 4
What's the difference?
print("I", "love", "Python") VS print("I" + " love " + "Python") What is more efficient? And more readable?
3 Réponses
+ 2
, is to sperate by a space
+ just adds it on directly to the end of the string before
+ 2
With using comma separator you just give arguments to print functions but with plus sign you do a string concatenation to create a new string.What is better depends on your need in core code used for.
+ 2
Just an additional
With using comma, you can costumize what that comma represents
By default, comma means whitespace.
But you can change the "sep" or comma with whatever character you want.
For example:
print("This", "is", "a", "string", sep="@@")
>> This@@is@@a@@string