Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. str1 = red man juice
  2. str2 = the red man drank the juice
  3.  
  4. one_lst = ['red','man','juice']
  5. lst1 = ['the','red','man','drank','the','juice']
  6.  
  7. lst1 = ['the','[red]','[man]','drank','the','[juice]']
  8.  
  9. lst1 = list(str1.split())
  10. for i in range(0,len(lst1)):
  11. for j in range(0,len(one_lst)):
  12. if one_lst[j] == lst1[i]:
  13. str1 = str1.replace(lst1[i],'{}').format(*one_lst)
  14. lst1 = list(str1.split())
  15. print(lst1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement