python match case example
match subject:
case <pattern_1>:
<action_1>
case <pattern_2>:
<action_2>
case <pattern_3>:
<action_3>
case _:
<action_wildcard>
python match case example
match subject:
case <pattern_1>:
<action_1>
case <pattern_2>:
<action_2>
case <pattern_3>:
<action_3>
case _:
<action_wildcard>
python find matching string regardless of case
# credit to the Stack Overflow users in the source lin
# with regex
import re
if re.search('mandy', 'Mandy Pande', re.IGNORECASE):
# do your stuff here
# Note:
# results = re.search('mandy', 'Mandy Pande', re.IGNORECASE)
# results.group(0) is the string that matched ('Mandy')
# without regex
string1 = "hi"
string2 = "HI"
if string1.lower() == string2.lower():
print("Equals!")
else:
print("Different!")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us