Why does Python join two String Literals without operators?


Why does python join two String without any type of operator such as sum?


>>> 'Perro' 'Lobo'

Does the same as this:

>>> 'Perro' + 'Lobo'


Well, when a programming language does something like this, it is usually by design. In this case, as explained in the documentation :

Multiple adjacent string literals (delimited by whitespace), possibly using different quoting conventions, are allowed, and their meaning is the same as their concatenation


Multiple adjacent (whitespace-delimited) string literals, possibly using different citation conventions (that is, single or double quotes), are allowed and their meaning is the same as their concatenation.

Scroll to Top