1 import athletemodel 2 import yate 3 import glob 4 5 data_files = glob.glob("data/*.txt") 6 athletes = athletemodel.put_to_store(data_files) 7 8 9 Traceback (most recent call last): 10 File "C:\Lib\idlelib\16.py", line 6, in <module> 11 athletes = athletemodel.put_to_store(data_files) 12 File "C:\Lib\idlelib\athletemodel.py", line 23, in put_to_store 13 pickle.dump(all_athletes,ath) 14 UnboundLocalError: local variable 'ath' referenced before assignment 15 >>>
全局变量和局部变量问题,具体参考:
http://blog.csdn.net/onlyanyz/article/details/45009697
这里面总结不错:
http://www.cnblogs.com/perfei/p/5507617.html
谢谢!