How to return unique words from the text file using Python

后端 未结 9 2173
遇见更好的自我
遇见更好的自我 2021-01-04 23:45

How do I return all the unique words from a text file using Python? For example:

I am not a robot

I am a human

Should return:

9条回答
  •  失恋的感觉
    2021-01-05 00:11

    try:
        with open("gridlex.txt",mode="r",encoding="utf-8")as india:
    
            for data in india:
                if chr(data)==chr(data):
                    print("no of chrats",len(chr(data)))
                else:
                    print("data")
    except IOError:
        print("sorry")
    

提交回复
热议问题