Python:联机控制台Python中的错误

Python:联机控制台Python中的错误,python,console-application,Python,Console Application,我正在使用python的在线控制台: 我正在尝试编写以下代码: class tree: def __init__(self, charge, left=None, right=None): self.charge = charge self.left = left self.right = right 当我编写第一行类树:时,我按下回车键,从控制台得到这个错误 Traceback (most recent call last): File "/base/data/home/app

我正在使用python的在线控制台: 我正在尝试编写以下代码:

class tree:
 def __init__(self, charge, left=None, right=None):
  self.charge = charge
  self.left = left
  self.right = right
当我编写第一行
类树:
时,我按下回车键,从控制台得到这个错误

Traceback (most recent call last):
File "/base/data/home/apps/shell/1.335852500710379686/shell.py", line 221, in get 
compiled = compile(statement, '<string>', 'single')
File "<string>", line 2
 ^
IndentationError: expected an indented block
回溯(最近一次呼叫最后一次):
get中的文件“/base/data/home/apps/shell/1.335852500710379686/shell.py”,第221行
compiled=compile(语句“”,“单个”)
文件“”,第2行
^
缩进错误:应为缩进块
有人能告诉我怎么写这段代码吗?
谢谢。

您必须在该应用程序的文本框中输入整个类。我知道,它与通常的Python shell不同。:)


粘贴你的代码;它会起作用。

您需要立即输入课程的所有内容。要转到新行,请使用
Shift+Enter
。例如,这对我来说很有效-

class tree:        # press Shift+Enter here
    print 'aas'    # press Enter when you are done

从这里复制并粘贴回。您可能在那里的某个地方有一个错误的空格,但如果从这里复制,它会工作。

不要使用ENTER。
如在线外壳页面底部所示,使用:

按住Shift键并输入换行符


由于问题没有显示出任何研究成果(指令就在它的正下方!),所以被否决了。此外,堆栈溢出是完全错误的询问此类问题的地方。充其量,超级用户将是一个好去处。