# 获取苏宁商品尺码 suning_products['size'] = suning.get_suning_product_size(browser) # 比较苏宁淘宝商品颜色 add_color = suning.compare_taobao_suning_color( taobao_colors, suning_products['color']) # 比较苏宁淘宝商品尺码 add_size = suning.compare_taobao_suning_size(taobao_sizes, suning_products['size']) # 下载需要添加颜色的照片且修改照片信息 # 照片命名格式 img\taobao_id_position.jpg if taobao_sizes: first_size_key = taobao.get_taobao_frist_size_key(taobao_sizes) current_dir = taobao.get_current_dir() add_color_remove = [] for color, key in add_color.items(): str_key = re.sub("[:]", "", key) image_name = str(taobao_id) + "_" + str_key + ".jpg" image_path = current_dir + "\img\\" + image_name if taobao_sizes: image_key = first_size_key + ";" + key else: image_key = key print(image_key) if image_key in taobao_products: print(taobao_products[image_key][5]) taobao.download_taobao_image(taobao_products[image_key][5], image_path)