From a73dbba3871d1f7eb5a966fa899e1915b1f62f16 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 7 Mar 2020 13:50:39 -0800 Subject: [PATCH] Use enumerate(start=1) instead of index += 1. --- epubfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/epubfile.py b/epubfile.py index 0aec2b2..bd5ce1c 100644 --- a/epubfile.py +++ b/epubfile.py @@ -1415,9 +1415,8 @@ def merge( index_length = len(str(len(input_filepaths))) rand_prefix = random_string(3, string.digits) - for (index, input_filepath) in enumerate(input_filepaths): - # Number books from 1 for human sanity. - index += 1 + # Number books from 1 for human sanity. + for (index, input_filepath) in enumerate(input_filepaths, start=1): print(f'Merging {input_filepath.absolute_path}.') prefix = f'{rand_prefix}_{index:>0{index_length}}_{{}}' input_book = Epub.open(input_filepath)