Use enumerate(start=1) instead of index += 1.

This commit is contained in:
Ethan Dalool 2020-03-07 13:50:39 -08:00
parent b99eecf8c5
commit a73dbba387

View file

@ -1415,9 +1415,8 @@ def merge(
index_length = len(str(len(input_filepaths))) index_length = len(str(len(input_filepaths)))
rand_prefix = random_string(3, string.digits) rand_prefix = random_string(3, string.digits)
for (index, input_filepath) in enumerate(input_filepaths): # Number books from 1 for human sanity.
# Number books from 1 for human sanity. for (index, input_filepath) in enumerate(input_filepaths, start=1):
index += 1
print(f'Merging {input_filepath.absolute_path}.') print(f'Merging {input_filepath.absolute_path}.')
prefix = f'{rand_prefix}_{index:>0{index_length}}_{{}}' prefix = f'{rand_prefix}_{index:>0{index_length}}_{{}}'
input_book = Epub.open(input_filepath) input_book = Epub.open(input_filepath)