[Tutor] Reading Files and Such

Alan Gauld alan.gauld at btinternet.com
Thu Oct 9 21:42:25 CEST 2008


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote

> Yes, listdir does not read files, it just prepares a list of all 
> files
> in the folder. I work my way through them as needed. It looks
> like glob does something similar.

Yes but glob can use wildcards to select only files matching
the pattern (eg *.txt to list only txt files)

> The real question is about tmp files. I believe there's a tmpfiles 
> module.
> What's so special about the tmp suffix?

On XP very little but on *nix it generally means a file to be stored
in the tmp folder and often with an auto generated filename based
on the process ID - which avoids problems when multiple
instances of the same program run. Also the tmp file is often
emptied when the system boots so avoiding disk wastage.
Using tempfuiles helps manage these things a little but on
XP has very luittle advantage because XP itself doesn't really
do much of anything with tmp files... But if you want the
script or module to ever be ported/used on *nix then using
tempfiles is still worthwhile.

HTH

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list