i have a directory with around 1000 files....i want to run a same code for each of these file...
my code requires the file name to be inputted.
i have written code to copy the information of one into other in other format... please suggest a method to copy all 1000 files one by one without need to change the file name every time
and i have a field serial_num which need to be continous i.e if 1st file has upto 30 then while coping other file it should continue from 30not from 0 again
require help
thanks..
from string import Template
from string import Formatter
import pickle
f=open("C:/begpython/wavnk/text0004.lab",'r')
p='C:/begpython/wavnk/text0004.wav'
f1=open("C:/begpython/text.txt",'a')
m=[]
i=0
k=f.readline()
while k is not '':
k=f.readline()
k=k.rstrip('\n')
mi=k.split(' ')
m=m+[mi]
i=i+1
y=0
x=[]
j=1
t=(i-2)
while j<t:
k=j-1
l=j+1
if j==120 or j==i:
j=j+1
else:
x=[]
x = x + [y, m[j][2], m[k][2], m[l][2], m[j][0], m[l][0], p]
y=y+1
#f1.writelines(str(x)+'\n')
for item in x:
f1.write(str(item)+' ')
f1.write(str('\n'))
j=j+1
f.close()
f1.close()
my code.....
and i have files name in series like text0001.....text1500.lab and want to run them at a time without need to call them everytime by changin name
enter code here