update,
This commit is contained in:
16
vinniesniper-54816/task1/_lab/003-crawler-bus/merge.py
Normal file
16
vinniesniper-54816/task1/_lab/003-crawler-bus/merge.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def merge_images(input_folder, output_folder):
|
||||
if not os.path.exists(output_folder):
|
||||
os.mkdir(output_folder)
|
||||
|
||||
count = 0
|
||||
for root, _, filenames in os.walk(input_folder):
|
||||
for fn in filenames:
|
||||
if fn.endswith('.jpg'):
|
||||
count += 1
|
||||
shutil.copy(os.path.join(root, fn), os.path.join(output_folder, 'c_{:010d}.jpg'.format(count)))
|
||||
|
||||
if __name__ == '__main__':
|
||||
merge_images('p', 'output')
|
Reference in New Issue
Block a user