Feb-04-2020, 07:26 AM
Try this to see if helps,
Sandeep
GANGA SANDEEP KUMAR
recs = {1: ['Susan Smith', '[email protected]'], 2: ['Cole Brown', '[email protected]'], 3: ['Sue John', '[email protected]']} print(recs) temp=[] for key,val in recs.items(): for j in val: temp.append(j.replace(".com", ".org")) recs[key]=temp temp=[] print(recs)
Output:python test1.py
{1: ['Susan Smith', '[email protected]'], 2: ['Cole Brown', '[email protected]'], 3: ['Sue John', '[email protected]']}
{1: ['Susan Smith', '[email protected]'], 2: ['Cole Brown', '[email protected]'], 3: ['Sue John', '[email protected]']}
Best Regards,Sandeep
GANGA SANDEEP KUMAR
User has been warned for this post. Reason: Providing a homework solution