title: How do I check if a string matches a certain type of string format that I created?
body: <p>I want to check if a string matches a certain string format by using lists like this:</p>
  <pre><code># Creating the lists
  
  year = [&quot;%02d&quot; % x for x in range(2015, 2100)]
  month = [&quot;%02d&quot; % x for x in range(13)]
  day = [&quot;%02d&quot; % x for x in range(32)]
  
  # Checking if the string is in a certain format
  
  if &quot;2017-7-16&quot; == f&quot;{year}-{month}-{day}&quot;:
      print(&quot;a&quot;)
  else:
      print(&quot;b&quot;)
  </code></pre>
  <p>But that doesn't seem to be the way to do it, is it even possible?</p>