title: how can I combine a switch-case and regex in Python
body: <p>I want to process a string by matching it with a sequence of regular expression. As I'm trying to avoid nested if-then, I'm thinking of switch-case. How can I write the following structure in Python? Thank you</p>
  
  <pre><code>switch str:
     case match(regex1):
         # do something
     case match(regex2):
         # do sth else
  </code></pre>
  
  <p>I know Perl allows one to do that. Does Python?</p>