title: Python - Split Function - list index out of range
body: <p>I'm trying to get a substring in a for loop. For that I'm using this:</p>
  
  <pre><code>for peoject in subjects:
          peoject_name = peoject.content
          print(peoject_name, " : ", len(peoject_name), " : ",  len(peoject_name.split('-')[1]))
  </code></pre>
  
  <p>I have some projects that don't have any "-" in the sentence. How can I deal with this? </p>
  
  <p>I'm getting this issue:</p>
  
  <pre><code>builtins.IndexError: list index out of range
  </code></pre>