Python - Standard Library Usage
You want to read all lines from a file and store them in a list without newline characters. Which code correctly does this?
line.strip() removes newline characters and spaces from each line.readlines() keeps newlines, read() returns whole text, and splitting may leave empty strings.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions