[Solved] 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

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