Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- str1 = red man juice
- str2 = the red man drank the juice
- one_lst = ['red','man','juice']
- lst1 = ['the','red','man','drank','the','juice']
- lst1 = ['the','[red]','[man]','drank','the','[juice]']
- lst1 = list(str1.split())
- for i in range(0,len(lst1)):
- for j in range(0,len(one_lst)):
- if one_lst[j] == lst1[i]:
- str1 = str1.replace(lst1[i],'{}').format(*one_lst)
- lst1 = list(str1.split())
- print(lst1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement