找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 2900|回复: 1

[求助] 运行此代码,出现ImportError: No module named 'athletelist',求助

1

主题

1

帖子

1

积分

贫民

积分
1
luckyman 发表于 2017-2-22 18:08:46 | 显示全部楼层 |阅读模式
import pickle
from athletelist import AthleteList   

def get_coach_data(filename):
    try:
        with open(filename) as f:
            data=f.readline()
        templ=data.strip().split(',')
        return(AthleteList(templ.pop(0),templ.pop(0),templ))
    except IOError as ioerr:
        print('file error',+str(ioerr))
        return(None)

def put_to_store(files_list):
    all_athletes = {}
    for each_file in files_list:
        ath = get_coach_data(each_file)
        all_athletes[ath.name] = ath
    try:
        with open('athletes.pickle','wb') as athf:
            pickle.dump(all_athletes,athf)
    except IOError as ioerr:
        print('File error(put_and_store):' + str(ioerr))
        return(all_athletes)

def get_from_store():
    all_athletes = {}
    try:
        with open('athletes.pickle','rb') as athf:
            all_athletes = pickle.load(athf)
    except IOError as ioerr:
        print('File error(get_from_store):'+str(ioerr))
        return(all_athletes)

回复

使用道具 举报

1419

主题

1891

帖子

291

积分

侠客

积分
291

最佳新人热心会员默默耕耘

whydo1 发表于 2017-2-23 09:04:11 | 显示全部楼层
如果模块已经安装。那么检查一下程序名称是不是和athletelist重名?
python3.4.4, win10
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表