import os
for root,dirs,files in os.walk('./'):
for file in files:
if file.endswith('.oldext'):
F=open(os.path.join(root,file),'r')
W=open('./foldername/'+file.replace('.oldext','.newext'),'w')
for line in F.readlines():
W.write(line)
W.close()
F.close()
print 'All Extensions changed Successfully'
----------------------------------------------------------
change the file extensions as your need
replace oldext with the extension your files are currently having
replace newext with the new extension you want to have for all of ur files
save the above code in a file with .py extension
create a folder named foldername in same directory where the python file is saved
keep all the files whose extension you want to change in the same folder as code file