title: Printing list to file?
body: <p>i have a list as follows:</p>
  <pre><code>list = [{'option': 'add list'},
           {'ids': ['1', '2', '3']},
           {'option': 'add to log'},
           {'ids': ['1', '5', '6']}]
  </code></pre>
  <p>when output this to file:</p>
  <pre><code>with open('list.json', 'w') as outfile:
          json.dump(list, outfile)
  </code></pre>
  <p>it writes the file as:</p>
  <pre><code>[{&quot;option&quot;: &quot;add list&quot;}, {&quot;ids&quot;: [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]}, {&quot;option&quot;: &quot;add to log&quot;}, {&quot;ids&quot;: [&quot;1&quot;, &quot;5&quot;, &quot;6&quot;]}]
  </code></pre>
  <p>i need to write this to a text file as:</p>
  <pre><code>{&quot;option&quot;: &quot;add list&quot;, &quot;ids&quot;: [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]}
  {&quot;option&quot;: &quot;add to log&quot;, &quot;ids&quot;: [&quot;1&quot;, &quot;5&quot;, &quot;6&quot;]}
  </code></pre>
  <p>i understand this is not valid json but unfortunately this is the format i need to create for another process. i have looked at the existing answers and they don't give what i need.</p>