今天,继续研究python,在看到采用mvc设计web应用时,抄写athletemodel.py,点击保存。点击运行(按F5)
这时重新打开了一个IDLE,我点击了关闭,还在原来的IDLE中继续操作,先写了dir(),显示结果正常,但是往下的操作就不正常了,
>>> dir()
['AthleteList', '__annotations__', '__builtins__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'athl', 'athletemodel', 'athlist', 'data', 'data11', 'get_coach_data', 'get_from_store', 'pickle', 'put_to_store', 'the_files']
>>> from athletemodel import put_to_store
>>> the_files = ['sarah.txt', 'julie.txt', 'mikey.txt', 'james.txt']
>>> data11 = put_to_store(the_files)
>>> data11
下面什么也不显示~~~为什么?
查google,找度娘,代码一字一字对,最后在点F5运行之后,打开的新的IDLE中又写了一遍如上的代码,最后结果出现了!难道是因为刷新编译的问题吗?
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
==================== RESTART: C:\Python36\athletemodel.py ====================
>>> dir()
['AthleteList', '__annotations__', '__builtins__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'get_coach_data', 'get_from_store', 'pickle', 'put_to_store']
>>> the_files = ['sarah.txt', 'julie.txt', 'mikey.txt', 'james.txt']
>>> data11 = put_to_store(the_files)
>>> data11
{'Sarah Sweeney': ['2:58', '2.58', '2:39', '2-25', '2-55', '2:54', '2.18', '2:55', '2:55', '2:22', '2-21', '2.22'], 'Julie Jones': ['2.59', '2.11', '2:11', '2:23', '3-10', '2-23', '3:10', '3.21', '3-21', '3.01', '3.02', '2:59'], 'Mikey McManus': ['2:22', '3.01', '3:01', '3.02', '3:02', '3.02', '3:22', '2.49', '2:38', '2:40', '2.22', '2-31'], 'James Lee': ['2-34', '3:21', '2.34', '2.45', '3.01', '2:01', '2:01', '3:10', '2-22', '2-01', '2.01', '2:16']}
>>>