File size: 522 Bytes
d6be317 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import sys
def remove_empty_lines(input_file, output_file):
with open(input_file, 'r') as file:
lines = file.readlines()
with open(output_file, 'w') as file:
for line in lines:
if line.strip():
file.write(line)
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python remove_empty_lines.py <input_file>")
sys.exit(1)
input_file = sys.argv[1]
output_file = 'no_empty_lines.txt'
remove_empty_lines(input_file, output_file) |