lists and files question
hokiegal99
hokiegal99 at hotmail.com
Tue Jul 22 19:57:06 EDT 2003
This code:
import os, re, string
setpath = raw_input("Enter the path: ")
for root, dirs, files in os.walk(setpath):
id = re.compile('Microsoft Excel Worksheet')
fname = files
# print fname
content = open(fname[1],'rb')
Produces this error:
IOError: Error[2] No such file or directory 'Name of File'
The strange thing is that it correctly identifies the file that it says
doesn't exist. Could someone explain why this is?
Also, is "files" a nested list? It looks like one, but I'm not entirely
sure as I'm still relatively new to Python. Thanks!
More information about the Python-list
mailing list