acecalisto3 commited on
Commit
7cfcffc
1 Parent(s): 332b2b5

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +15 -0
utils.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ def format_directory(directory):
4
+ """Formats the contents of a directory for display."""
5
+ try:
6
+ # List all files in the directory
7
+ files = os.listdir(directory)
8
+ if not files:
9
+ return "No files found."
10
+
11
+ # Create a formatted string of files
12
+ formatted_files = "\n".join(files)
13
+ return formatted_files
14
+ except Exception as e:
15
+ return f"Error accessing directory: {str(e)}"