title: With django templates, how to remove the last item newline in a loop
body: <p>I would like to use the Django template engine to build some text files :</p>
  
  <p>I wrote this script :</p>
  
  <pre><code>from django.template import Template, Context
  from django.conf import settings
  settings.configure()
  with open('etchosts') as fh:
      t = Template(fh.read().strip())
      c = Context({'hosts': ['host A','host B', 'host C']})
      print t.render(c)
  </code></pre>
  
  <p>And the template file "etchosts" :</p>
  
  <pre><code>=================================
  {% for h in hosts %} - {{ h }}
  {% endfor %}
  =================================
  </code></pre>
  
  <p>If I run the script I got :</p>
  
  <pre><code>=================================
   - host A
   - host B
   - host C
                  &lt;----- unwanted newline
  =================================
  </code></pre>
  
  <p>As you see, there is an unwanted newline at the end of the loop</p>
  
  <p>How can I change my template to have :</p>
  
  <pre><code>=================================
   - host A
   - host B
   - host C
  =================================
  </code></pre>
  
  <p>?</p>