Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import codecs
- print("Write count of inputed files\n")
- count_of_files = int(input())
- dictionary = []
- for i in range(1, count_of_files + 1):
- print("Write path to the " + str(i) + " inputed file\n")
- if i == 1:
- print("Example of path: \"/home/username/folder/example.txt\"\n")
- path = str(input())
- with codecs.open(path, "r", "utf-8") as ifs:
- for line in ifs:
- items = line.split()
- for item in items:
- if dictionary.count(item) == 0:
- dictionary.append(item)
- dictionary.sort()
- print("Write path to the folder where need to save a dictionary\n")
- print("Example of path: \"/home/username/folder/\"\n")
- path = str(input())
- with codecs.open(path + "dictionary.txt", "w", "utf-8") as ofs:
- for word in dictionary:
- ofs.write("%s\n" % word)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement