About 159,000 results
Open links in new tab
  1. python - Match case statement with multiple 'or' conditions in …

    Dec 2, 2022 · Match case statement with multiple 'or' conditions in each case Asked 3 years ago Modified 1 year, 3 months ago Viewed 37k times

  2. How to use multiple cases in Match (switch in other languages) …

    Oct 20, 2021 · I am trying to use multiple cases in a function similar to the one shown below so that I can be able to execute multiple cases using match cases in python 3.10 def …

  3. What is the Python equivalent for a case/switch statement?

    Jul 14, 2012 · Python 3.10.0 provides an official syntactic equivalent, making the submitted answers not the optimal solutions anymore! In this SO post I try to cover everything you might …

  4. What is the syntactical equivalent to switch/case in Python?

    Mar 30, 2021 · In Python, match is actually much more than a simple switch - therefore probably the name. It features special functionality like deep placeholders and wildcards.

  5. How to do an else (default) in match-case? - Stack Overflow

    Aug 16, 2021 · Python recently has released match-case in version 3.10. The question is how can we do a default case in Python? I can do if/elif but don't know how to do else. Below is the …

  6. Python: match/case by type of value - Stack Overflow

    May 18, 2022 · I came across a weird issue while using the new match/case syntax in Python3.10. The following example seems like it should work, but throws an error: values = [ …

  7. python - Continue to match next case after match? - Stack Overflow

    Feb 28, 2023 · According to the official Python documentation (PEP 636), once the first matching pattern is found, the body of that case is executed, and all further cases are ignored. …

  8. python - How to use values stored in variables as case patterns ...

    Although, given how python is trying to implement pattern-matching, I think that for situations like this it's probably safer and clearer code to just use an if/elif/else tower when checking against …

  9. python match case part of a string - Stack Overflow

    Nov 9, 2022 · I want to know if I can use match cases within Python to match within a string - that is, if a string contains the match case. Example: mystring = "xmas holidays" match …

  10. python - How to use match case with a class type - Stack Overflow

    Mar 11, 2022 · I want to use match to determine an action to perform based on a class type. I cannot seem to figure out how to do it. I know their are other ways of achieving this, I would …