AiAi0 / utils.py
acecalisto3's picture
Create utils.py
7cfcffc verified
raw
history blame
459 Bytes
import os
def format_directory(directory):
"""Formats the contents of a directory for display."""
try:
# List all files in the directory
files = os.listdir(directory)
if not files:
return "No files found."
# Create a formatted string of files
formatted_files = "\n".join(files)
return formatted_files
except Exception as e:
return f"Error accessing directory: {str(e)}"