为什么我为特定员工ID培训图像创建文件夹的这些语句会出现无效的语法错误?
if __name__ == '__main__':
image = []
camera = config.get_camera()
# Create the directory for positive training images if it doesn't exist.
if not os.path.exists(config.Subject_Dir):
os.makedirs(config.Subject_Dir)
foldername = os.path.join(config.Subject_Dir, Filename + '%03d' % (config.Subject_Id)
# Create the folder for specific Employee ID training images if it doesn't exist.
if not os.path.exists(foldername):
os.path.makedirs(foldername)
# Find the largest ID of existing images.
# Start new images after this ID value.
files = sorted(glob.glob(os.path.join(foldername,'[0-9][0-9][0-9]' + '.pgm')))
count = 0
答案 0 :(得分:0)
您收到语法错误,因为在行
foldername = os.path.join(config.Subject_Dir, Filename + '%03d' % (config.Subject_Id)
你没有关闭第一个括号。只需将)
添加到该行的末尾,如下所示:
foldername = os.path.join(config.Subject_Dir, Filename + '%03d' % (config.Subject_Id))