Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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!")
Comment

PREVIOUS NEXT
Code Example
Python :: python import shelve 
Python :: python profile is not defined line_profiler 
Python :: get users except superuser django 
Python :: store array to nii file 
Python :: <ipython-input-7-474520f490a8 
Python :: how to get the original start_url in scrapy 
Python :: inline_ternary(if)_condition 
Python :: bson to dataframe pandas 
Python :: AI code for diagnosing diseases 
Python :: time vs timeit 
Python :: Return monthly sales value in Django 
Python :: flask crud generator 
Python :: iloc vs iat 
Python :: how call a class in another class python 
Python :: xgb plot importance round 
Python :: pyttsx3 ichanging voices 
Python :: Python Anagram Using Counter() function 
Python :: Flatten List in Python Using Without Recursion 
Python :: foreach on sysargv 
Python :: install Social Auth App Flask 
Python :: python count files fast 
Python :: mk270 suits for programming reddit 
Python :: list update python 
Python :: Python NumPy atleast_2d Function Example 2 
Python :: python read file with class 
Python :: Python NumPy asscalar Function Syntax 
Python :: catch all event on socketio python 
Python :: Python __ge__ 
Python :: Open S3 object as string in Python 3 
Python :: django disable foreign key checks temporary 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =