python3代码出现错误,怎么解决

图片说明
提示except出错,到底为什么

except IOError as ioerr:

下面没有代码了吗? 语法错误啊

如果你下面不写代码你可以这样:
1、except IOError as err:pass
或者你打印输出错误
except IOError as err:
print(err)

```#!/usr/bin/env python

-*- coding: utf-8 -*-

class Athlete:
def init(self, a_name, a_dob = None, a_times = []):
self.name = a_name;
self.dob = a_dob;
self.times = a_times;

def top3(self):
    return sorted(set([sanitize(t) for t in self.times])[0:3]);
def get_coach_data(self, filename):
    try:
        with open(filename) as f:
            data = f.readline();
            templ = data.strip().split(",");
            return Athlete(templ.pop(0), templ.pop(0), templ);
    except IOError as ioerr:
        print(ioerr);

a = Athlete("a", None, [1,2,3]);
a.get_coach_data("test.txt")

get_coach_data少了个self参数,
还有get_coach_data的return那一行,为什么是 templ.pop(0).templ.pop(0),
改了这两个地方,运行没有报错

test.txt的内容:
111,222,33,444,555

ps: 如果是语法错误的话可以用ide看看,都会有提示的, 如果是vim/emacs的话也有语法排错的插件.