[Tutor] renumbering a sequence

simone simozack at yahoo.it
Wed Aug 27 08:46:37 CEST 2008


Christopher Spears ha scritto:

> As you can see, the only part I haven't figured out is the actual renumbering.  Can't figure out how to do the following:
> 0017 convert to -> 0001
> 0018 convert to -> 0002
> 0019 convert to -> 0003
> etc.
> 
> Any hints?  Thanks.

IMHO, you can renumber everything without testing the right order. An 
example:

for progress, file_name in enumerate(ordered_list):
    frame, num, ext = file_name.split('.')
    print "%s.%s.%s" % (frame, str(progress).zfill(4), ext)

And you will have what you want (if I understand right...).

--
Simone
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



More information about the Tutor mailing list