网上学习代码,报错 SyntaxError: unexpected EOF while parsing 遇到这个问题先检查 括号 符号 有没有少写的 查看源代码 res = sorted(res.iteritems(), key=lambda x : x[1]) 代码是python2.x的版本 res.iteritems()已经在python3.x 下掉了所以修改为 res = sorted(res.items(), key=lambda x : x[1])