fork(1) download
  1. ss = ['test2@gmail.com:123456',
  2. 'test2@hotmail.com:124554134',
  3. 'test1@yahoo.com:fdsfsdfe',
  4. 'test5@gmail.com:9875464',
  5. 'no com']
  6. res = [s.rsplit("com:")[1] if "com:" in s else s for s in ss]
  7. print(res)
Success #stdin #stdout 0.01s 23352KB
stdin
Standard input is empty
stdout
['123456', '124554134', 'fdsfsdfe', '9875464', 'no com']