import res = ['e004_n07','e000_n00']res = [re.sub(r'(?<=[a-zA-Z])0+(\d*)', lambda m: m.group(1) if m.group(1) else '0', x) for x in s]print(res)
Standard input is empty
['e4_n7', 'e0_n0']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!