|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Ok, my script works a little differently but gets the output you need. What do you mean he wants both renames? As in the first rename replaces Slide1.jpg (etc) and then the second rename is a copy?
Mark. |
|
#17
|
|||
|
|||
|
I want to stick with copy. Copy first Slide1.jpg to s00.jpg to s00L.jpg
|
|
#18
|
|||
|
|||
|
|
|
#19
|
||||
|
||||
|
A slitly reworked, more flexable version of my previous script which instead or renaming the files makes a copy.. you end up with 3 sets, Slidex.jpg, s0x.jpg and s0xx.jpg
![]() It's virtually identical to the last with os.rename() replaced with shutil.copyfile() and a new vairable 'starts' which holds the start string of the files your targeting i.e. 'Slides' and a few other little changes ![]() Mark. |
|
#20
|
|||
|
|||
|
quick question, How do you write a counter that counts 01, 02, 03 ...10, 11 not 1,2,3,4,5,6,7...10,11
|
|
#21
|
|||
|
|||
|
dunno if there's another way, but this works
def pad(input): input = str(input) if len(input) == 1: input = "0"+input return input Last edited by lazy_yogi : October 17th, 2003 at 03:36 AM. |
|
#22
|
|||
|
|||
|
Partly ironic:
Code:
def counter():
i = 0
while True:
yield "%02d" % (i+1,)
i += 1
>>>count = counter()
>>>for i in range(3):
... count.next()
...
'01'
'02'
'03'
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > file renaming |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|