建立文件夹 if not osp.exists(directory): try: os.makedirs(directory) 按格式出0001.jpg cv2.imwrite(dis_jpg_per_mov_dir + ‘/’ + str(f’{i:05d}’) + ‘.jpg’, frame)