QuestionQ10

VerifiedPython Basics for Data Analysis

You are reading a data.csv file one line at a time. To get each line ready for formatting with f-strings, you must remove extra whitespace and split its values on commas.

Which line should you add to properly clean and parse the input?

Explanation

In Python, line.strip() removes leading and trailing whitespace, including the newline at the end of a line. Calling .split(', ') on the cleaned string separates the comma-and-space-delimited fields into a list.

Community Discussion

No comments yet. Be the first to start the discussion!