I found some code that helped me to accomplish incrementing (numerically) files in a particular folder. However, I don’t understand why [0] was used in a certain section in the code. Here is a portion of the code, thanks:
...
...
numList = [0]
for dlogs in sampleList:
i = os.path.splitext(dlgs)[0] #Why here?
try:
num = re.findall('[0-9]+$', i)[0] # and here?
numList.append(int (num))
...
...
...
I understand crystal clear now. I could not see that before … thanks. For those who voted my question down, everyone has to start somewhere. If my question seemed too elementary, why not conserve your energy and just skip my question.
In the lines you ask about, those functions return lists, and the first item (index 0) of each list is being assigned to a variable. For example: