title: Map unique strings to integers in Python
body: <p>I have a list, let say 
  <code>L = ['apple','bat','apple','car','pet','bat']</code>.</p>
  
  <p>I want to convert it into 
  <code>Lnew = [ 1,2,1,3,4,2]</code>. </p>
  
  <p>Every unique string is associated with a number.</p>
  
  <p>I have a java solution using <code>hashmap</code>, but I don't know how to use <code>hashmap</code> in python.
  Please help.</p>