I want to write a script that takes a list of images and renumbers them with a 
user supplied number.  Here is a solution I came up while noodling around in 
the interpreter:

>>> alist = ["frame.0001.tif","frame.0002.tif","frame.0003.tif"]
>>> new_start = 5000
>>> for x in alist:
...     name, number, ext = x.split(".")
...     new_frame = name + "." + str(new_start) + "." + ext
...     new_start = new_start + 1
...     print new_frame
...
frame.5000.tif
frame.5001.tif
frame.5002.tif

How is that for a solution?  Is there a more elegant way to solve this problem?


      
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to