If you have a list in a
Python script and wish to add new items to the list, you can
use listname.append(newitem)
where listname is
the name of the list and newitem is the item you wish to add to the list.
If you wish to add new items to the list only if they don't already
exist in the list, you can avoid adding an existing entry to the list
by checking if the entry is already in the list as shown below:
filenameList = [] if filename not in filenameList: filenameList.append(filename)
If you wish to know the length of a list, i.e., how many items are
on the list, you can use print len(listname)
where
listname is the name of your list.