Are elements separated in a list with a comma? [closed]

The difference is that list1's value would be ['abc'], while list2's value would be ['a', 'b', 'c'].

Observe:

>>> ['a' 'b' 'c']
['abc']
>>> ['a', 'b', 'c']
['a', 'b', 'c']
>>> 

This is due to the fact that adjacent string literals (delimited by whitespace), possibly using different quoting conventions, are allowed, and their meaning is the same as their concatenation. Thus, "hello" 'world' is equivalent to "helloworld".

The above is a quote from the documentation: String literal concatenation


The first example creates a list with one element, ['abc']. The second creates a list with 3 elements: ['a', 'b', 'c'].