Answers for "find all characters in string python"

2

python get all characters

import string

# all the lowercase and uppercase letters
print(string.ascii_letters)
# every printable key on your keyboard
print(string.printable)
# every digit
print(string.digits)
Posted by: Guest on February-08-2020
3

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]
Posted by: Guest on May-07-2020
2

count characters in string python

>>> sentence = 'Mary had a little lamb'
>>> sentence.count('a')
4
Posted by: Guest on December-30-2020

Code answers related to "find all characters in string python"

Python Answers by Framework

Browse Popular Code Answers by Language