mirror of
https://github.com/instaloader/instaloader.git
synced 2024-11-05 01:42:29 +01:00
Refactor get_filename
Use string formatting instead of `str(0) + str(index)` and don't assume file extension is three characters.
This commit is contained in:
parent
d2bebcd00c
commit
c54342bb98
@ -255,8 +255,7 @@ class Instaloader:
|
|||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
def get_filename(index):
|
def get_filename(index):
|
||||||
return filename if index == 0 else (filename[:-4] + '_old_' +
|
return filename if index == 0 else '{0}_old_{2:02}{1}'.format(*os.path.splitext(filename), index)
|
||||||
(str(0) if index < 10 else str()) + str(index) + filename[-4:])
|
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while os.path.isfile(get_filename(i)):
|
while os.path.isfile(get_filename(i)):
|
||||||
|
Loading…
Reference in New Issue
Block a user