fork download
  1. import re
  2.  
  3. rx = r'\d+'
  4. incoming = ["Radio0","Tether0","Serial0/0","Eth0/0","Eth0/1","Eth1/0","Eth1/1","vlanX","modem0","modem1","modem2","modem3","modem6"]
  5.  
  6. outgoing = []
  7. for item in incoming:
  8. t = re.sub(rx, 'X', item)
  9. if t not in outgoing:
  10. outgoing.append(t)
  11. print(outgoing)
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
['RadioX', 'TetherX', 'SerialX/X', 'EthX/X', 'vlanX', 'modemX']