I am new to python and would like to know if there is an easy way to search for strings in an array with the same start characters.
for example i have a list
ex = [exA, exB, teA, exC]
and you want to get the result for all that match the first two characters of something like this:
{'ex': 3, 'te': 1}
I tried to work with the Counter method from collections, but I can not get the result as shown above.
Thank you for advanced
source
share