E
E
Egorian2018-05-16 11:37:35
Python
Egorian, 2018-05-16 11:37:35

What does % mean here?

Now I'm reading the Django documentation and I can't figure out what % does in this code:

def detail(request, question_id):
    return HttpResponse("You're looking at question %s." % question_id)

def results(request, question_id):
    response = "You're looking at the results of question %s."
    return HttpResponse(response % question_id)

def vote(request, question_id):
    return HttpResponse("You're voting on question %s." % question_id)

% replaces itself with the value of question_id?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fixid, 2018-05-16
@Egorian

Yes
Manual

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question