Re: [Tutor] renumbering a sequence

2009-04-05 Thread spir
Le Sat, 4 Apr 2009 20:05:41 -0400, Kent Johnson s'exprima ainsi: > On Sat, Apr 4, 2009 at 3:37 PM, Christopher Spears > wrote: > > > > 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

Re: [Tutor] renumbering a sequence

2009-04-04 Thread Dave Angel
Christopher Spears wrote: 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 i

Re: [Tutor] renumbering a sequence

2009-04-04 Thread Kent Johnson
On Sat, Apr 4, 2009 at 3:37 PM, Christopher Spears wrote: > > 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.

[Tutor] renumbering a sequence

2009-04-04 Thread Christopher Spears
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, nu

Re: [Tutor] renumbering a sequence

2008-08-27 Thread Paul McGuire
One problem with my previous post. I didn't look closely enough at the original list of files, it turns out you have multiple entries for some of them. If you used the glob module to create this list (with something like "original_list = glob.glob('frame.*.dpx')"), then there should be no problem

Re: [Tutor] renumbering a sequence

2008-08-27 Thread Paul McGuire
I am thinking along similar lines as Simone, but I suspect there is still a missing step. I think you need to know what the mapping is from old name to new name, so that you can do something like rename or copy the files that these names represent. Python's built-in zip() method does the trick he

Re: [Tutor] renumbering a sequence

2008-08-27 Thread Alan Gauld
"Christopher Spears" <[EMAIL PROTECTED]> wrote ordered_list = sorted(unordered_list) test_frame_1 = ordered_list[0].split('.')[1] test_frame_2 = ordered_list[1].split('.')[1] if test_frame_1 == "": if test_frame_2 =! "0001": print "Sequence needs to be renumbered" for frame in

Re: [Tutor] renumbering a sequence

2008-08-26 Thread simone
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

[Tutor] renumbering a sequence

2008-08-26 Thread Christopher Spears
I'm trying to write a script that will renumber items in a list. Here is the list: unordered_list = ["frame.0029.dpx", "frame.0028.dpx", "frame.0025.dpx", "frame.0026.dpx", "frame.0027.dpx", "frame.0017.dpx", "frame.0019.dpx", "frame.0023.dpx", "frame.0018.dpx",