title: How to decrease space between paragraphs in python-docx
body: <p>Am trying to decrease spacing between paragraph with the code below in <code>python-docx</code> but when apply the the formatting to the paragraph the last paragraph shrinks but the line between the paragraphs doesn't decrease.</p>
  
  <p>i found some examples here <a href="https://stackoverflow.com/questions/18449617/decreasing-the-vertical-space-when-using-the-paragraph-function-in-the-python-do">link 1</a> and <a href="https://stackoverflow.com/questions/48150222/changing-paragraph-formatting-in-python-docx/48160795">link 2</a>which but don't understand the <code>xml</code> part to achieve desired results.</p>
  
  <p>I need your assistances to decrease the spacing between the paragraphs through python but not setting it via word file.</p>
  
  <pre><code>from docx import Document
  from docx.shared import Inches
  from docx.enum.style import WD_STYLE_TYPE
  from docx.shared import Pt
  
  
  document = Document()
  
  document.add_heading('THIS IS MY HEADER WANT TO UNDERLINE IT')
  
  
  paragraph = document.add_paragraph('THIS IS MY FIRST PARAGRAPH ')
  paragraph = document.add_paragraph('THIS IS SECOND PARAGRAPH')
  paragraph = document.add_paragraph('SPACING BETWEEN EACH SHOULD BE DECREASED')
  
  paragraph_format = paragraph.paragraph_format
  paragraph_format.line_spacing = Pt(3)
  paragraph_format.space_after = Pt(5)
  
  
  print("document created")
  
  document.save('demo.docx')
  </code></pre>