Below you can see the sequence commands which simply add elements from the dirs
list to some other list new
using special built-in function:
new = Trajectory(os.path.join(path, dirs[0]))
new.addFile(os.path.join(path, dirs[1]))
new.addFile(os.path.join(path, dirs[2]))
new.addFile(os.path.join(path, dirs[3]))
I need to simplify this script placing all new.addFile
in a loop like:
for element in dirs:
new.addFile(os.path.join(path, element)
The question: how to add some rule which exclude dirs[0]
to adding using this loop on the first step? In my case dirs[0]
is already always present within new
so I need not to add it again while looping the first list.