I have been trying to figure this out for a while and I just cant
I want to reverse a file that looks like this
Hello there
My name is
How are you
And by reversing it i mean I want it to look like this after
there Hello
is name My
you are How
I have tried with
lines = []
with open('test.txt', "r") as f:
lines = f.readlines()
with open('testrev.txt', 'w') as f:
for line in reversed(lines):
f.write(line)
and by adding
f.write(line[::-1])
Im sorry but i just cannot figure this out and help would be greatly appriciated