On Apr 5, 2005 10:43 AM, Jeffrey Maitland <[EMAIL PROTECTED]> wrote: > That approach works, but so does this one. > > import os, glob > > input_file_list = glob.glob('*.txt') > for in_file in input_file_list: > name = in_file.split('.') > os.rename(in_file, str(name[0]) + '.' + 'text')) >
you should really use in_file.splitext - your script renames myfile.with.lots.of.dots.txt to myfile.text instead of myfile.with.lots.of.dots.text . If you *really* wanted to use split(), it oughta be ''.join(in_file.split('.')[:-1]) , but why not use the built-in? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list