>>> mylist = ['a','b']>>> Mylist.append (['C','D'])>>>mylist['a','b', ['C','D']]>>> Mylist.extend (['e','F'])>>>mylist['a','b', ['C','D'],'e','F']
>>> mylist.index ('b')1>>> mylist.index (['C ','d'])2
+ and *>>> in the list operationmylist['a','b', ['C','D'],'e','F']>>> mylist = MyList + ['g','h']>>>mylist['a','b', ['C','D'],'e','F','g','h']>>> MyList + = ['I']>>>mylist['a','b', ['C','D'],'e','F','g','h','I']>>> yourlist = ['1','2','3']>>> yourlist = yourlist * 3>>>yourlist['1','2','3','1','2','3','1','2','3']>>>
What is True in Python:
- 0 is false; All other values are true.
- Empty string ("") is false; All other strings are true.
- The empty list ([]) is false; All other strings are true.
- Empty tuple (()) is false; All other strings are true.
- Null dictionary ({}) is false; All other strings are true.
Python list about Append&extend