title: Else Syntax Error Python
body: <pre><code>if len(user_hash) &gt; 0:
    with open(log_file, "w") as log_f:
      for name in user_hash:
          log_f.write("Name:%s \n Email: %s" % (name, email)
  
      else len(user_hash) &lt; 0:
         print "Nothing happened :("
  </code></pre>
  
  <p>I keep getting a syntax error on the else statement and I am unsure why it keeps producing this error. I don't have any other else statements in the same def and it still gives error. What do I do?</p>