Creation of both homogeneous and heterogeneous lists. : Introduction : List PYTHON TUTORIALS


PYTHON TUTORIALS » List » Introduction »

 

Creation of both homogeneous and heterogeneous lists.


numList = [2000200320052006]
stringList = ["Essential""Python""Code"]
mixedList = [12"three"4]
subList = ["A""B"["C"2006]]
listList = [numList, stringList, mixedList, subList]

for x in listList:
    for y in x:
        if isinstance(y, int):
            print y + 1
        if isinstance(y, basestring):
            print "String:" + y



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo List
» Introduction