with open('file.txt', 'r') as file:
print(file.read())
with open('file.txt', 'w') as f:
f.write('Create file in write mode')
my_list = [
'apple', 'banana', 'orange'
]
with open('file.txt', 'w') as f:
for line in my_list:
f.write(f'{line}\n')
with open('input_file.txt', 'r') as input_file, open('output_file.txt', 'w') as output_file:
for line in input_file:
if not line.isspace():
output_file.write(line)