1
私はので、私をあわれんでくださいパイソンに新たなんです。 私の環境は次のとおりです。なぜ私が取得しています「IndentationError:予想インデントブロック」
import os,
import urllib.request
IRIS_TRAINING = "iris_training.csv"
IRIS_TRAINING_URL = "http://download.tensorflow.org/data/iris_training.csv"
if not os.path.exists(IRIS_TRAINING):
raw = urllib.request.urlopen(IRIS_TRAINING_URL).read()
私はアナコンダスパイダーで実行している、と私はF9でコードをステップ実行するとき、私が取得:
>>> import os
>>> import urllib.request
>>> IRIS_TRAINING = "iris_training.csv"
>>> IRIS_TRAINING_URL = "http://download.tensorflow.org/data/iris_training.csv"
>>> if not os.path.exists(IRIS_TRAINING):
... raw = urllib.request.urlopen(IRIS_TRAINING_URL).read()
File "<stdin>", line 2
raw = urllib.request.urlopen(IRIS_TRAINING_URL).read()
^
IndentationError: expected an indented block
私は、次のコードを持って
macOS Sierra 10.12.4 and Anaconda 4.3.16
は、なぜ私はこのエラーを取得していますか?
チャールズは
えっ?上記のコードでわかるように、4つのスペースでインデントされています。私はもう一度点検し、4つのスペースをタイプした。私はまだエラーが発生します! – CBrauer
これはSpyderのバグでなければなりません。私はPython 3で(Spyderの外で)スクリプトを実行しましたが、エラーなしで動作しました。 – CBrauer