SHARE
TWEET

Untitled

a guest Jun 26th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lookup = ['Chicken','Burger','Ham','Salmon','Chicken Breast']
  2. example = [['Burger','1'], ['Ham','3'], ['Salmon','0'], ['Chicken','5'], ['Chicken Breast','2']]
  3.      
  4. ctr=0
  5. for y in lookup:
  6.     example = [[x.replace(y,str(ctr)) for x in l] for l in example]
  7.     ctr=ctr+1
  8. print (example)
  9.      
  10. import re
  11. ctr=0
  12. for x in lookup:
  13.     example = [[re.sub(r'b'+x+r'b', str(ctr), y) for y in l] for l in example]
  14.     ctr=ctr+1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top