title: In python, how do I call upon excel sheet column to match a user input?
body: <pre><code>import pylightxl as xl
  
  with open('city.xlsx', 'rb') as f:
      db = xl.readxl(f)
  
  l = list(db.ws(ws='Sheet1').col(col=3))
  
  cc = input(&quot;What is your country code?:  &quot;).upper()
  
  d ={}
  for cc in l:
      CC = cc.upper()
      if CC in d:
          d[CC] = d[CC] + 1
      else:
          d[CC] = 1
  
  
  l2 = list(db.ws(ws='Sheet1').col(col=3)[0:])
  matches = 0
  for cc in l2:
      if cc == #This is where I want to match the 3 letter Code to Excel
          matches += 1
  print(&quot;{} Countries match&quot;.format(matches)) 
  </code></pre>
  <p>I am currently trying to get the cc = input (max 3 letters) to count any of the matching country codes from the city.xlsx. If I were to input for example AFG into the</p>
  <pre><code>if cc = &quot;AFG&quot;:
  </code></pre>
  <p>when I run the script I would enter AFG and get a count of the matching country codes, however that only works for the one specific country code, I am wondering how I can make it so that the script can apply to any and all the codes that are within the xlsx file. (The excel file is from the World Database converted to excel)</p>
  <p><a href="https://i.stack.imgur.com/YLlZu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YLlZu.png" alt="enter image description here" /></a></p>