w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Python program prints an extra empty line when reading a text file

print adds and at the end of the string, and considering the line you've read already has a new line at the end, that's the behaviour. You can use instead:

print(line, end="")

Hope this helps!

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.