Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to find the location of a character in a string in python

>>> myString = 'Position of a character'
>>> myString.find('s')
2
>>> myString.find('x')
-1
Comment

PREVIOUS NEXT
Code Example
Python :: drop a row with a specific value of a column 
Python :: if found then stop the loop python 
Python :: python difflib compare two strings 
Python :: Django less than and greater than 
Python :: python exceptions 
Python :: show all urls django extensions 
Python :: named tuple python iterate 
Python :: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable 
Python :: python to create pandas dataframe 
Python :: draw bounding box on image python opencv 
Python :: copy from folder to folder python 
Python :: strings are immutable in python 
Python :: tqdm python 
Python :: how store list in django session 
Python :: title() function in python 
Python :: keys in python 
Python :: hide code in jupyter notebook 
Python :: python get desktop directory 
Python :: python check if number is in range 
Python :: how to round off values in columns in pandas in excel 
Python :: sort dict by values 
Python :: show multiple plots python 
Python :: python how to create dict from dataframe based on 2 columns 
Python :: Taking a list of strings as input, our matching function returns the count of the number of strings whose first and last chars of the string are the same. Also, only consider strings with length of 2 or more. python 
Python :: sort list by key 
Python :: python check for duplicate 
Python :: rotate image in pygame 
Python :: how to get unique value of all columns in pandas 
Python :: dictionary with double key python 
Python :: check object type python 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =