← All Exercises
Python String Methods
basicpython
Background
String methods are the primary tools for text processing in Python, used in parsing, cleaning, and transforming data.
Problem
Write a function that takes a CSV string and returns a list of cleaned field values with whitespace stripped and empty fields removed.
Input
A string containing comma-separated values.
Output
A list of stripped, non-empty field values.
Sample tests
Sample 1
Input: " apple , banana , , cherry "
Expected: ["apple", "banana", "cherry"]
Your solution
Learning objective
Learn string splitting, stripping, and filtering for CSV-like data processing.