Spaces:
Running
Running
import os | |
import pandas as pd | |
def read_md_files_from_doctors(): | |
doctors_folder = 'doctors' | |
data = [] | |
for filename in os.listdir(doctors_folder): | |
if filename.endswith('.md'): | |
file_path = os.path.join(doctors_folder, filename) | |
with open(file_path, 'r', encoding='utf-8') as file: | |
content = file.read() | |
data.append({'filename': filename, 'content': content}) | |
df = pd.DataFrame(data) | |
return df | |
# Example usage | |