我在IDLE for Python上测试了一些代码,我有一段时间没用过了,结果偶然发现了一个不寻常的错误。我试着运行这个简单的代码: for i in range(10):print('Done') 我记得shell是逐行工作的,所以下面是我首先做的: >>> for i in我尝试了另一种方法,因为下一条语句可能需要在开头,如下所示: >>> for
下面的代码是打印从1到1000之间5的倍数之和for i in range(1, 1001):print(s)
如果我在空闲状态下运行这段代码,结果是100500,但是在shell中有一个错误SyntaxError:无效语法,出现在print。为什么空闲和shell会给出不同的结果?我的Python版本是3.7。
导入整个包在IDLE中有效,但在shell中无效。以下代码在IDLE中运行良好:tk.filedialog.askopenfilename()AttributeError:'module' object has no attribute 'filedialog'
我知道我必须使用import tkinter.filedialog才能让它在she