import requests import markdown from pathlib import Path import pathlib ndir = Path("/Users/normrasmussen/Documents/Work/CustomerNotes/") def get_files(): files = list(ndir.glob("**/*.md")) for company in files: # This Section gets the Company name for the payload. company = str(company) company_file = company.split("/")[-1] company_name = company[:-3] print(company_name) get_data(company_file, company_name) def get_data(company_file, company_name): company_path = Path( f"/Users/normrasmussen/Documents/Work/CustomerNotes/{company_file}") with company_path.open(mode="r", encoding="utf-8") as md_file: for num, line in enumerate(md_file, 1): if line.startswith("## "): print(f"Line Number is {num} and the line is {line}") if __name__ == "__main__": get_files()