I know I am missing something obvious, but I am having a= difficult time trying to get this to work. s =3D 'This string contains a CLR' d =3D {'CLR ': 'CLEAR', 'CA': 'ACCEPT', 'CR': 'CALL REQUEST'} if s has d.keys(): do stuff