title: How to custom sort in a Python list?
body: <p>I have a Python list as follows,</p>
  
  <pre><code>demo= {'age': 90, 'id': '12#2'}
  {'age': 12, 'id': '12#3'}
  {'age': 67, 'id': '12#1'}
  {'age': 56, 'id': '12#2'}
  {'age': 34, 'id': '12#2'}
  </code></pre>
  
  <p>How can I sort this list with id attribute?</p>
  
  <p>I have tried </p>
  
  <pre><code>sorted(demo, key=lambda x: x.id)   # sort by id
  </code></pre>
  
  <p>but it failed.</p>
  
  <p>Expected output as follows:</p>
  
  <pre><code>{'age': 90, 'id': '12#2'}
  {'age': 56, 'id': '12#2'}
  {'age': 34, 'id': '12#2'}
  {'age': 12, 'id': '12#3'}
  {'age': 67, 'id': '12#1'}
  </code></pre>