ich möchte alle Dateien eines Ordners einlesen und dann die Dateiendungen per sliptext abtrennen. Hierzu versuche ich Folgendes, um die Liste anschließend per Bottle in ein Template zu füllen:
Code: Alles auswählen
for filename in os.walk("bilder"):
images = os.path.splitext(filename)[0]
return template('template', images=images)
Code: Alles auswählen
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/bottle.py", line 499, in handle
return handler(**args)
File "galerie.py", line 8, in index
images = os.path.splitext(filename)[0]
File "/usr/lib/python2.6/posixpath.py", line 95, in splitext
return genericpath._splitext(p, sep, altsep, extsep)
File "/usr/lib/python2.6/genericpath.py", line 91, in _splitext
sepIndex = p.rfind(sep)
AttributeError: 'tuple' object has no attribute 'rfind'
Grüße