example:
my list is ['tree','world','tre','worl']
my dict is {'tre':'good','worl':nice}
my scripts:
def replace(list, dictionary):
for i in list:
for k in dictionary:
list = list.replace(k, dictionary[k])
return list
print replace(input_file,curaw_dict)
but every time I receive the result is like:
goode
niced
good
nice
how can I make it more accurate make it like
tree
world
good
nice
Thanks alot
listas a variable name. It sqashed the function of the same namelisthas no method calledreplace. Please create the shortest possible program that accurately demonstrates the error and copy-paste (never retype) that program into your question. See minimal reproducible example for more information.