Scripting >> Python >> Examples >> Operators >> List Operations

>>> list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]
>>> tinylist = [123, 'john']
>>>
>>> print (list)          # Prints complete list
['abcd', 786, 2.23, 'john', 70.2]
>>> print (list[0])       # Prints first element of the list
abcd
>>> print (list[1:3])     # Prints elements starting from 2nd till 3rd
[786, 2.23]
>>> print (list[2:])      # Prints elements starting from 3rd element
[2.23, 'john', 70.2]
>>> print (tinylist * 2)  # Prints list two times
[123, 'john', 123, 'john']
>>> print (list + tinylist) # Prints concatenated lists
['abcd', 786, 2.23, 'john', 70.2, 123, 'john']World!TEST