Find Unique Characters in a File

前端 未结 22 2342
耶瑟儿~
耶瑟儿~ 2021-02-04 03:30

I have a file with 450,000+ rows of entries. Each entry is about 7 characters in length. What I want to know is the unique characters of this file.

For instance, if my f

22条回答
  •  长情又很酷
    2021-02-04 04:05

    Python without using a set.

    file = open('location', 'r')
    
    letters = []
    for line in file:
        for character in line:
            if character not in letters:
                letters.append(character)
    
    print(letters)
    

提交回复
热议问题