0
私はPythonシェルで以下のコードを貼り付けます。インデントエラーが発生します。Django Pythonシェルインデントエラー
... print "this is an ideal answer for both" File "", line 2 print "this is an ideal answer for both" ^IndentationError: expected an indented block
def get_match(user_a, user_b):
user_a_answers = UserAnswer.objects.filter(user=user_a)[0]
user_b_answers = UserAnswer.objects.filter(user=user_b)[0]
if user_a_answers.question.id == user_b_answers.question.id:
user_a_answer = user_a_answers.my_answer
user_a_pref = user_a_answers.their_answer
user_b_answer = user_b_answers.my_answer
user_b_pref = user_b_answers.their_answer
if user_a_answer == user_b_pref:
print "%s fits with %s's preference" %(user_a_answers.user.username, user_b_answers.user.username)
if user_a_pref == user_b_answer:
print "%s fits with %s's preference" %(user_a_answers.user.username, user_b_answers.user.username)
if user_a_answer == user_b_pref and user_a_pref == user_b_answer:
print "this is an ideal answer for both"
get_match(mohit, saraswati)
get_match(saraswati, userc)
get_match(mohit, userc)
私はシェルからこれを実行したときに私はあなたのインデント誤差を決定することは困難である理由? `
私は – Raghu
をファイルから実行しようとしましたが、別のシェルで実行すると同じコードですか? –