f = open('a.txt', 'r', encoding = 'utf-8') s = f.readline() print(s) ouf = open('a.out', 'w', encoding = 'windows-1251') ouf.write(s) ouf.close()