Browse Source

排序问题

rambo 1 month ago
parent
commit
0b266834f0
1 changed files with 2 additions and 2 deletions
  1. 2 2
      python/service/deal_image.py

+ 2 - 2
python/service/deal_image.py

@@ -320,7 +320,7 @@ class DealImage(BaseDealImage):
                     continue
 
                 all_original_images = os.listdir(_path)  # 遍历货号原始图文件夹
-                sort_result = sorted(all_original_images, key=lambda x: int(re.findall(r'^(\d+)_', x)[0]) if re.findall(r'^(\d+)_', x) else 0)
+                sort_result = sorted(all_original_images, key=lambda x: int(re.findall(r'((\d+))', x)[0]) if re.findall(r'((\d+))', x) else 0)
                 goods_pic_total = len(sort_result)
                 if not sort_result:
                     continue
@@ -328,7 +328,7 @@ class DealImage(BaseDealImage):
                 image_file_path = "{}/{}/原始图/{}".format(
                     dir_path, goods_art_no_folder, image_file
                 )
-
+                # print("\033[1;32;40m 需要处理的200images,路径: \033[0m",image_file_path,all_original_images,sort_result)
                 if not os.path.exists(
                         "{}/{}/200images".format(dir_path, goods_art_no_folder)
                 ):