sholden at bellatlantic.net
Thu Feb 10 14:56:38 CET 2000
Although, technically, directories are files, the Python file reading
utility functions don't have any way of interpreting their contents.
Consequently you will get an IOError (in my case, 21, "Is a directory").
Try taking a look at the os library module documentation. You will see
it includes various useful bits and pieces. You might find os.listdir
especially useful, as it returns a list of the entries in a directory.
>>> import os
>>> os.listdir("r:/ZipDisks/Text Editors")
['emacs-19_34_6-bin-i386_tar.gz', 'pfe0702i.zip', 'UltraEdit32.zip',
> Pedro Silva wrote:
> I'm trying to use OPEN to open a folder, because I need to get the content of
> that folder.
> This folder is in the filesystem.
> The code line that I'm using is:
> f = open('var/spool/news/articles','r')
> fs = f.realines()
???? f.readlines() ?????
> return fs
> But this is giving me and error. Is this correct or because articles is a
> folder and is because of that that the error is displayed.
> Please send me your answers to: psilva at ruido-visual.pt
"If computing ever stops being fun, I'll stop doing it"
More information about the Python-list