title: Pass a set of different parameters in a list to a function
body: <p>I am trying to pass a list of arguments to a function I have created. </p>
  
  <pre class="lang-py prettyprint-override"><code>def pdftotext(params=[], layout='-layout'):
      cmd = ['pdftotext', params, '-layout']
      return cmd
  </code></pre>
  
  <p>This is how I call it:</p>
  
  <pre class="lang-py prettyprint-override"><code>text = pdftotext(params=['-f', '1', '-l', '2'])  
  return text              
  </code></pre>
  
  <p>This generates below:</p>
  
  <pre><code>[
    "pdftotext",
    [
      "-f",
      "1",
      "-l",
      "2"
    ],
    "-",
    "-layout"
  ]
  </code></pre>
  
  <p>However, as you can see, an extra <code>[]</code> is added where the <code>params=[]</code> are passed.</p>
  
  <p>I have tried converting the params to a string, like:</p>
  
  <pre><code>params = ','.join(params)
  </code></pre>
  
  <p>But this doesn't work either, as it simply joins each param and separates it with a comma.</p>
  
  <p>How can I pass a set of different parameters to my function, without it creating a double list?</p>