title: Iterate through Python Dictionary without knowing the specific keys
body: <p>I can't seem to figure out how to write this piece of Python Code.</p>
  
  <p>I need to read something in from a file, which is this:</p>
  
  <pre><code>Jake FJ49FJH
  Bob FJ49GKH
  </code></pre>
  
  <p>I've imported the file into a dictionary. I then check if the number plate (following the names) contains the sequence of two letters, two numbers, then three letters. Here is that part of the code:</p>
  
  <pre><code>d = {} # Blank Dictionary
  
  with open("plates.txt") as f:
    d = dict(x.rstrip().split(None, 1) for x in f) # Put file into dictionary
  
  names = d.keys()
  print(names)
  #carReg = ??
  
  
  a,b,c = carReg[:2],carReg[2:4],carReg[4:]
  if all((a.isalpha(),b.isdigit(),c.isalpha(),len(c)== 3)):
      print("Valid Reg")
  else:
      print("Invalid Reg")
      # Now get the name of the person with the invalid carReg
  </code></pre>
  
  <p>As you can see, I don't know what to put for <code>carReg</code>. I need to loop through the dictionary, like in a list when you can use an integer to get part of the list. If the program returns <code>Invalid Reg</code>, then I need to get the key that the invalid reg belongs to - which will be a name.</p>
  
  <p>Any help appreciated.</p>