Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

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

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]