% ipython3
Python 3.4.2 (default, Oct 8 2014, 13:08:17)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.0 An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: n = 5
In [2]: while n >= 0:
...: n = n-1
...: print(n)
...: print ("TO A!!")
...:
4
3
2
1
0
-1
TO A!!
In [3]:
我想出现这个错误是因为pythonshell不支持它。它希望你一次只做一件事。!我在python2.7shell中也做了同样的事情,它说:
当我在python3.4shell中做同样的事情时,它说:
unexpected indent.
默认的pythonshell对于输入工作正常,但它确实不理解从剪贴板粘贴。真正的解决方案是安装
ipython
,这是python的一个高级shell,有许多优点:您需要在
while
循环后按enter退出循环在注:
...
表示您仍在while
块中相关问题 更多 >
编程相关推荐