python program to reverse each word in a file