I have a dictionary in python and I have to remove specific substring of a value:
dict1 = {'property': 'contents and properties', 'content': 'content metaData creationdate21023415:22:24creationdate metaDataend headingContent headingContent metaData creationDate22102312:02:05creationDate metaDataend DirContent DirContent'}
I have to remove the substring associated with key 'content'
. In that, I want to remove from metaData
to metaDataend
, and every time there is a re-occurrence of metaData
in the same string, I want to remove that as well.
Expected End result:
{'property': 'contents and properties', 'content': 'content headingContent headingContent DirContent DirContent'}