longer = "ABC(a =2,b=3,c=5,d=5,e=Something)"
shorter = re.sub(r',s*d=d+,s*e=[^)]+', '', longer)
# shorter: 'ABC(a =2,b=3,c=5)'
When the OP finally knows how many elements are there in the list, he can also use:
shorter = re.sub(r',s*d=[^)]+', '', longer)
it cuts the , d=
and everything after it, but not the right parenthesis.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…