write a program that reads a file called 'test.txt' and prints out the contents on the screen after removing all spaces and newlines. punctuations will be preserved. for example, if 'test.txt' contains: this is a test file, for chapter 06. this a new line in the file! then, your program's output will show:

Respuesta :

A program that reads a file called 'test.txt' and prints out the contents on the screen after removing all spaces and newlines. punctuations will be preserved.

A computer follows a collection of instructions called a program to carry out a certain task. The size of a computer program affects the likelihood that an error may occur.

# Read lines as a list

fh = open("transfer-out/" + file, "r")

lines = fh.readlines()

fh.close()

# Weed out blank lines with filter

lines = filter(lambda x: not x.isspace(), lines)

# Write "transfer-out/"+file+".txt", "w"

fh = open("transfer-out/"+file, "w")

#fh.write("".join(lines))

# should also work instead of joining the list:

fh.writelines(lines)

fh.close()

Learn more about Program here-

https://brainly.com/question/3224396

#SPJ4