python - variable in range function -


i trying write script creates new file names (the content of files same). result should follows:

file_10_11.txt, file_10_12.txt, ..., file_10_100.txt

(resulting 90 files , first batch of files).

file_10_11.txt, file_10_12.txt, ..., file_10_99.txt

(resulting 89 files , second batch of files). then

file_10_11.txt, file_10_12.txt, ..., file_10_98.txt.

and @ last way until file_10_10.txt. see last number drops 100 10 step of 1.

what doing first batch of files following:

for x in range(9,100):     initial_file = 'c:\users\alex\desktop\test\x_y.txt'     dest_file = 'c:\users\alex\desktop\test\file_' + str(x+1) + '_100.idf'     shutil.copy2(initial_file, dest_file) 

how can put in loop rest batches of file renaming?

not sure why need because generating same file name multiple times. instance, file_10_10.txt generated 91 times. want can accomplish 2 backwards loops:

for x in range(100, 9, -1):     y in range(x, 9, -1):         print 'file_10_' + str(y) + '.txt' 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -