[Tutor] padding frames
littledanehren at yahoo.com
Sun Jan 11 14:29:47 EST 2004
Christopher Spears wrote:
> zfill is a great tool, but how would I go about
> isolating the part of file's name (DSCN-2.JPG) that
> would need? My first idea is to somehow get the
> (or their names anyway) into a list as strings:
> x = ['DSCN-2.JPG', 'DSCN-11.jpg', 'DSCN-101.JPG',
> Then somehow strip off the parts I don't need and
> zfill on the numbers:
> >>>'DSCN-' + x.zfill(4) + '.JPG'
If you wanted to let that work for all of them, you
should probably do:
>>> 'DSCN-' + x[5:-4].zfill(4) + '.JPG'
Is that what you wanted?
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
More information about the Tutor