import glob# Get a list of all Markdown files in the directorymd_files = glob.glob("*.md")# Sort the file list if neededmd_files.sort()# Open the output file in write mode with UTF-8 encodingwith open("merged.md", "w", encoding="utf-8") as outfile: # Iterate over each Markdown file for file_name in md_files: # Open each file in read mode with UTF-8 encoding and read its contents with open(file_name, "r", encoding="utf-8") as infile: contents = infile.read() # Write the contents to the output file outfile.write(contents) outfile.write("\n") # Add a newline between filesprint("Files merged successfully.")