I am doing a dictionary manipulation using regex in Python.I want to remove 1dc.com
or 1DC.com
or 1dc.COM
or 1DC.COM
from a dictionary item.
Example Dictionary -
{'system_name': 'a1pvdb092', 'fdc_inv_sa_team': 'X2AIX_GBS'}
{'system_name': 'W00000001.1DC.com', 'fdc_inv_sa_team': 'LAA.BRAZIL.AAA.WINDOWS\n'}
{'system_name': 'a10000048', 'fdc_inv_sa_team': 'X2AIX_NSS'}
{'system_name': 'a10000049', 'fdc_inv_sa_team': 'X2AIX_NSS'}
Expected Output -
['a1pvdb092']
['W00000001']
['a10000048']
['a10000049']
Script -
import re
from opswareConnect import data
for row in data:
arg1 = [row["system_name"],]
arg1 = re.sub('[.1DC.com]\\b', '', str(arg1))
print arg1
Output from the script -
['a1pvdb092']
['WBPVAP001Dco']
['a10000048']
['a10000049']