I need to match all upper case letters in a string, but not duplicates of the same letter in python I've been using
from re import compile
regex = compile('[A-Z]')
variables = regex.findall('(B or P) and (P or not Q)')
but that will match ['B', 'P', 'P', 'Q'] but I need ['B', 'P', 'Q'].
Thanks in advance!