I\'m wondering if there is more elegant way to check if the string (str = \'abcccbbaabcbca\') contains only \'a\',\'b\' or \'c\' than iterating over it :
for
Feel free to mock, since this jumps directly to a regular expression, but test for matching against "^[abc]+$"
"^[abc]+$"
re.match('^[abc]+$', 'string')