[Tutor] Please comment my -first- script

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Aug 18 09:29:37 CEST 2004

> I'd like to have some advice if some things could have been done
> File was renamed to txt for safer internet transfer.

Good idea on the rensame. it means it opens in notepad instead
of executing when I double click the attachment. I like it! :-)

You dopn't need the

s= string

line, you can just do:

import string as s

However I don't think you need the string module at all,
you can use the builtin string methods:

st = 2a string"
words = st.split()


Also the filename manipulation can be done with a python module
called os.path. It has functions for splitting and joining paths,
filenames, checking modification dates etc...

Not to mention the path.walk() function for traversing folders.


Alan G.

More information about the Tutor mailing list