1.idle打开文件f5运行后提示inconsistent use of tabs
确保编辑器设置为将制表符显示为8个空格
IDLE->format->untabify region,文本框内写入8后确定,点击F5运行即可
2.导入模块提示“no module named 'nester'”
推荐一篇好的博文:http://blog.sina.com.cn/s/blog_9d2b8cbf0102xekm.html,我用的是方法 2
![](https://img.haomeiwen.com/i3723022/6c9bbc75cc901373.png)
3.调用函数提示 NameError: name 'print_lol' is not defined
![](https://img.haomeiwen.com/i3723022/0e5454a746ef8a49.png)
在函数名前加上包的名字,包好比人的姓,通过姓氏找人;或者是书的章数,通过章才能找到小节,上面代码改为nester.print_lol(cast)即可
4.元组定义时报错,提示“tuple() takes at most 1 argument (3 given)”
![](https://img.haomeiwen.com/i3723022/e5907fdade337ae5.png)
????
5.文件打开时提示“Permission denied: 'E:\\study\\daim'”
![](https://img.haomeiwen.com/i3723022/25855ac4eb53196e.png)
跟目录有关系,windows下这个目录需要管理员权限,解决方案:去其他目录操作;更改当前目录权限,更改方法参考http://jingyan.baidu.com/article/c35dbcb0d036278917fcbc44.html
6.while()函数,提示 SyntaxError: 'break' outside loop
![](https://img.haomeiwen.com/i3723022/0b0e1adbf4a64862.png)
break 只能在循环体内不能放到循环体外
上面的login()和break进行替换就可以了
网友评论