这个错误是说r在使用前没有定义def cateToNum(c): if c == 'M PRO': r = 1 if c == 'F PRO': r = 2 if c == 'M PREMIER': r = 3 if c == 'F PREMIER': r = 4 if c == 'M OPEN': r = 5 if c == 'F OPEN': r = 6 if c == 'ATH': r = 7
经过排查后发现c 还有CLY这张情况没有处理,所以在遇到CLY时就会报错
修改后def cateToNum(c): if c == 'M PRO': r = 1 if c == 'F PRO': r = 2 if c == 'M PREMIER': r = 3 if c == 'F PREMIER': r = 4 if c == 'M OPEN': r = 5 if c == 'F OPEN': r = 6 if c == 'ATH': r = 7 if c == 'CLY': r = 8 return r
转载于:https://www.cnblogs.com/ajmd/p/6241105.html