I read file and print lines using python 2.7.8. But python always prints some extra empty lines.
I use the function:
def reverse(x):
linelist = open(x, 'r').readlines()
linelist.reverse()
for line in linelist:
print line
The content in my file is:
She sells seashells on the seashore;
The shells that she sells are seashells I`m sure.
So if she sells seashells on the seashore,
I`m sure that the shells are seashore shells.
But in the output, the last two print lines have extra empty lines:
I`m sure that the shells are seashore shells.
So if she sells seashells on the seashore,
The shells that she sells are seashells I`m sure.
She sells seashells on the seashore;