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

master
Ethan Dalool 2020-03-07 13:50:39 -08:00
parent b99eecf8c5
commit a73dbba387
1 changed files with 2 additions and 3 deletions

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)