import re for x in dir(re): if '_' in x: continue if x.upper() == x: num = int(getattr(re, x)) print(x, num, format(num, '08b'), sep='\t')