Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python3 return a list of indexes of a specific character in a string

string='mississippi'
s='s'
lst= []
for i in range(len(string)):
    if (string[i] == s):
        lst.append(i)
print(lst)
#result: [2, 3, 5, 6]
Comment

PREVIOUS NEXT
Code Example
Python :: python print string separated by comma 
Python :: python clock 
Python :: youtube-dl python download to specific folder 
Python :: tkinter app icon 
Python :: how to convert png to pdf with python 
Python :: tensorflow keras save model 
Python :: pip show all installed packages 
Python :: plt show 2 images 
Python :: python set symmetric difference 
Python :: python datetime date only 
Python :: dataframe sort by column 
Python :: first row as column df 
Python :: python pynput letter key pressed 
Python :: what is self keyword in python 
Python :: convert int to hex binary in python 
Python :: create a new file in python 3 
Python :: python time in nanoseconds 
Python :: how to import data from csv to jupyter notebook 
Python :: python zfill 
Python :: libreoffice add row at the end of table 
Python :: how to check the type of a variable in python 
Python :: remove nana from np array 
Python :: url in form action django 
Python :: find rows in dataframe from another dataframe python 
Python :: how to draw in pygame 
Python :: how to make random colors in python turtle 
Python :: get columns containing string 
Python :: accessing dictionary elements in python 
Python :: instagram private account hacking code python 
Python :: all alphanumeric characters for python python 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =