2017-02-02 141 views
0

這是我得到的輸出:我lerned怎麼辦,這裏IndentationError:取消縮進不匹配任何外部縮進級別教程

This is the output

https://docs.djangoproject.com/en/1.10/intro/tutorial03/

我的代碼是:

def index(request): 
    latest_question_list = Question.objects.order_by('-pub_date')[:5] 
    template = loader.get_template('polls/index.html') 
    context = { 
    ' latest_question_list': latest_question_list, 
    } 
    # output = ', '.join([q.question_text for q in latest_question_list]) 
    return HttpResponse(template.render(context, request)) 

而這是錯誤提出:

File "C:\Users\ab\mysite\polls\views.py", line 9 
    context = { 
     ^
IndentationError: unindent does not match any outer indentation level 

我在做什麼錯?

+0

只是從''latest_question_list':latest_question_list,''刪除空格...... –

+0

感謝這麼頻繁的回覆,但它不工作 – Kirtania

+4

深入研究縮進,混合空格和製表符,例如? – rocksteady

回答

0

運行Python時使用-tt選項。這會給你一個錯誤,如果你混合製表符和空格。

+0

感謝它會幫助很多.....欣賞它 – Kirtania

相關問題