title: How to convert letters to numbers with python?
body: <p>I have a dictionary 'g' and I want to convert all letters to numbers.</p>
  
  <pre><code>g = { "a" : ["c","e","h","m","k","i"],
        "b" : ["d","f","k","m"]
      }
  </code></pre>
  
  <p>I found this on stack overflow:</p>
  
  <pre><code>def alphabet_position_Headcrab(text):
      nums = [str(ord(x) - 96) for x in text.lower() if x &gt;= 'a' and x &lt;= 'z']
      return " ".join(nums)
  </code></pre>
  
  <p>and this one with a prefer:</p>
  
  <pre><code>def alphabet_position_wvxvw(text):
      result, i = [32, 32, 32] * len(text), 0
      for c in bytes(text.lower(), 'ascii'):
          if 97 &lt;= c &lt; 106:
              result[i] = c - 48
              i += 2
          elif 106 &lt;= c &lt; 116:
              result[i] = 49
              result[i + 1] = c - 58
              i += 3
          elif 116 &lt;= c &lt;= 122:
              result[i] = 50
              result[i + 1] = c - 68
              i += 3
      return bytes(result[:i-1])
  </code></pre>
  
  <p>But it works not for my dictionary but only for 1Dimensional dictionary like:</p>
  
  <pre><code>dic = { "a" : "g", "b" : "f"}
  </code></pre>
  
  <p>Thank you for your help ( perhaps is the answer obvious but I'm not an expert in coding)</p>