title: convert objectId to hex value pymongo
body: <p>I obtained the objectId from the database as follows:</p>
  
  <pre><code>    for mem in each.member_of:
          member_ty.append(mem)
  </code></pre>
  
  <p>where 'mem' has the objectId.</p>
  
  <p>each.member_of -- o/p --> [ObjectId('570e4c5da78dd04322f7a2a8')]</p>
  
  <p>Now in order to convert to string , I did following steps:</p>
  
  <pre><code>    for mem in each.member_of:
          member_ty.append(str(mem))
  </code></pre>
  
  <p>the o/p would be 
  ['570e4c5da78dd04322f7a2a8']</p>
  
  <p>The o/p required is : 570e4c5da78dd04322f7a2a8</p>
  
  <p>How can I do it ?
  I have tried toString(), valueOf() , tohexString(), but they dont work.</p>