title: Sort a list of strings based on 2 criteria
body: <p>I have a list of strings.</p>
  
  <p>I would like to sort them based on 2 criteria:</p>
  
  <ul>
  <li>from small length to large length</li>
  <li>if the length of 2 strings are same, then sort by <code>&lt;</code> of string values</li>
  </ul>
  
  <p>Does anyone know how to achieve that in Python?</p>
  
  <p>I tried</p>
  
  <pre><code>def cmp(a,b):
      if len(a) &lt; len(b):
          return -1
      elif len(a) &gt; len(b):
          return 1
      elif a &lt; b:
          return -1
      elif a &gt; b:
          return 1
      else:
          return 0
  
  myList.sort(lambda x,y: cmp(x, y))
  </code></pre>
  
  <p>But it gave me an error <code>TypeError: sort() takes no positional arguments</code>.</p>