[Tutor] padding frames

David Rock david at graniteweb.com
Sun Jan 11 12:52:26 EST 2004


* Christopher Spears <cspears2002 at yahoo.com> [2004-01-11 09:09]:
> Problem 1:
> How do I go about putting the files into a list?  Do I
> even need to put the files into a list?  After all, I
> just want to change their names.  Do the files need to
> be opened?

You will want them in a list so you can iterate over that list and make
changes as necessary. The files do not need to be opened to change their
names. Look into some of the modules under os, like listdir, rename,
etc.

http://www.python.org/doc/current/lib/os-file-dir.html

> Problem 2:
> How do I isolate the portion of the file name that I
> need?

You could use the re module which will allow you to match a specific
pattern and split up the filename and store different pieces to be
recalled later.

http://www.python.org/doc/current/lib/node109.html


-- 
David Rock
david at graniteweb.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20040111/bd75cc17/attachment.bin


More information about the Tutor mailing list