title: Is it possible to unpack a tuple replacing missing elements with None in python?
body: <p>I'm wondering if there is a way in python to unpack a tuple replacing missing elements with None.
  Here is an example:</p>
  <pre><code>username, password = credentials.split(':', maxsplit=1)
  </code></pre>
  <p>For the <code>credentials</code> equal to <code>root:123456</code> it returns <code>('root', '123456')</code> as expected.
  But for <code>credentials</code> equal to <code>root</code> it throws an exception <code>ValueError: not enough values to unpack (expected 2, got 1)</code> as expected as well, but not as I want.
  I want it to return <code>('root', None)</code> instead. Do you know how to do that?</p>
  <p>I could do it like this:</p>
  <pre><code>credentials_split = credentials.split(':', maxsplit=1)
  username, password = credentials_split[0], credentials_split[1] if len(credentials_split) &gt; 1 else None
  </code></pre>
  <p>But it's ugly, I'm looking for a better solution.
  Thanks in advance!</p>