How do I remove duplicate words from a list in python without using sets?

后端 未结 8 1656
渐次进展
渐次进展 2021-02-11 04:24

I have the following python code which almost works for me (I\'m SO close!). I have text file from one Shakespeare\'s plays that I\'m opening: Original text file:

\"Bu

8条回答
  •  旧时难觅i
    2021-02-11 04:35

    Below function might help.

       def remove_duplicate_from_list(temp_list):
            if temp_list:
                my_list_temp = []
                for word in temp_list:
                    if word not in my_list_temp:
                        my_list_temp.append(word)
                return my_list_temp
            else: return []
    

提交回复
热议问题