Python ProgrammingPython Programming

How to find all positions of a character in a string in Python?

test = 'canada#japan#uae'
c = '#'
print([pos for pos, char in enumerate(test) if char == c])
Output
[6, 12]