爲什麼我無法在我的shell中運行以下行?爲什麼我不能在我的Python shell中執行這樣的代碼?
>>> try:
... x = int("a lot")
... except items["error"] as e:
... # Same as except ValueError as e
... print("Couldn't convert")
錯誤消息:
>>> try: ... x=int("a lot") File "<stdin>", line 2 x=int("a lot")<&>
^
IndentationError: expected an indented block
>>>試試: ... X = INT( 「大量」) 文件 「」,2號線 X = INT( 「大量」) ^ IndentationError:預計會出現縮進塊 –
Muzab
您試圖使用哪個shell? –
不會添加其他信息或更正作爲評論,編輯您的原始帖子。 –