from fugashi_parser import * import os from pathlib import Path import shutil import hashlib vocab_destination_path = Path('/run/media/deck/YF8SD/Sync/Notebooks/Obsidian/Japanese/vocab') pos_list = list() for file_path in vocab_destination_path.iterdir(): if file_path.is_file(): # Ensure it's a file, not a subdirectory pos = file_path.stem.split('_')[1] pos_list.append(pos) if CONTENT_LINK_TAG.get(pos): #do a thing with open(file_path, "a") as file: #file.write("This text will be added to the end.") print(f"#{CONTENT_LINK_TAG[pos]}", file=file) else: print(pos, ' - no tag') # with file_path.open('r') as file: # content = file.read() # print(f"Content of {file_path.name}: {content}") unique_values = list(set(pos_list)) print(unique_values)