[Tutor] padding frames
Christopher Spears
cspears2002 at yahoo.com
Sun Jan 11 12:09:47 EST 2004
Hmmm...
zfill is a great tool, but how would I go about
isolating the part of file's name (DSCN-2.JPG) that I
would need? My first idea is to somehow get the files
(or their names anyway) into a list as strings:
x = ['DSCN-2.JPG', 'DSCN-11.jpg', 'DSCN-101.JPG',
'DSCN-2302.JPG']
Then somehow strip off the parts I don't need and run
zfill on the numbers:
>>>'DSCN-' + x[0][5].zfill(4) + '.JPG'
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?
Problem 2:
How do I isolate the portion of the file name that I
need?
Any thoughts, strategies?
=====
"I'm the last person to pretend that I'm a radio. I'd rather go out and be a color television set."
-David Bowie
"Who dares wins"
-British military motto
"Far more creativity, today, goes into the marketing of products than into the products themselves..."
-"Pattern Recognition" by William Gibson
More information about the Tutor
mailing list