Mit dieser Zeile in Python/Micropython lässt sich ein Verzeichnisinhalt so aufbereiten, dass es von ESP32 als Webseite ausgeliefert werden kann:

>>> import os
>>> verzeichnis_liste = ' Bytes</br>'.join([' - '.join([x[0], str(x[3])]) for x in os.ilistdir()])
>>> verzeichnis_liste
'apps - 0 Bytes</br>blocks - 0 Bytes</br>boot.py - 77 Bytes</br>emojiImg - 0 Bytes</br>img - 0 Bytes</br>main.py - 169 Bytes</br>res - 0 Bytes</br>temp.py - 85 Bytes</br>test.py - 0 Bytes</br>update - 0'
>>> 

Allerdings fügt .join() am Ende kein Trennungsstring mehr ein. Dieser muss dann noch hinzugegügt werden:

>>> verzeichnis_liste = ' Bytes</br>'.join([' - '.join([x[0], str(x[3])]) for x in os.ilistdir()]) + ' Bytes</br>'
>>> verzeichnis_liste
'apps - 0 Bytes</br>blocks - 0 Bytes</br>boot.py - 77 Bytes</br>emojiImg - 0 Bytes</br>img - 0 Bytes</br>main.py - 169 Bytes</br>res - 0 Bytes</br>temp.py - 85 Bytes</br>test.py - 0 Bytes</br>update - 0 Bytes</br>'

Nun ist es so wie es sein soll und kann in das HTML-Gerüst eingefügt werden.