Translate text encoding in python

import codecs

encFile = codecs.open(‘from-encoding.txt’, ‘rb’, ‘utf-8’)
decFile = open(‘to-encofing.csv’, ‘wb’)
text = encFile.read()
decFile.write(text.encode(‘windows-1251’) )
encFile.close()
decFile.close()