fork download
  1. import re
  2.  
  3. serials = ['d47a3c06-r188-4203-n838-fefd32082fd9', 'e48a3c08-r199-4203-n838-fefd32082fd0']
  4. corrected_serials = []
  5. for serial in serials:
  6. numbers = re.findall(r'\d+', serial)
  7. corrected_serials.append(''.join(numbers))
  8.  
  9. corrected_abbreviated = [item[0:5] for item in corrected_serials]
  10.  
  11. print corrected_serials
  12. print corrected_abbreviated
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
['473061884203838320829', '483081994203838320820']
['47306', '48308']