Comment supprimer une chaîne à l'intérieur d'une autre chaîne Python

 pythonCopylist_str = {'Abc.ex', 'Bcd.ex', 'cde.ex', 'def.jpg', 'efg.jpg'}
new_set = {x.replace('.ex', '').replace('.jpg', '') for x in list_str}
Grumpy Goat