title: Python how to handle split when delimiter not present?
body: <p>I have the following python code:</p>
  
  <pre><code>def split_arg(argv):
      buildDescriptor = argv[1]
      buildfile, target = buildDescriptor.split("#")
  
      return buildfile, target
  </code></pre>
  
  <p>It expects a string (<code>argv[1]</code>) of the form <code>buildfile#target</code> and splits them into two variables of the same name. So a string like "<em>my-buildfile#some-target</em>" will get broken into <em>my-buildfile</em> and <em>some-target</em> respectively.</p>
  
  <p>Sometimes though, there won't be "#" and target; sometimes you'll just have "<em>my-buildfile</em>", in which case I just want <em>target</em> to be "" (empty).</p>
  
  <p>How do I modify this function so that it will handle instances where "#" doesn't exist and it returns buildfile with an empty target?</p>
  
  <p>Currently, if I pass just the buildfile, it throws an error:</p>
  
  <pre><code>buildfile, target = buildDescriptor.split("#")
  ValueError: need more than 1 value to unpack
  </code></pre>
  
  <p>Thanks in advance!</p>