Editor

Split a CSV Line

Beginner · Write the code · from Every Python String Method Explained with Examples

From the lesson: Every Python String Method Explained with Examples

Strings in Python come with a toolbox of built-in methods. These methods let you change case, remove extra spaces, search for words, split text apart, and much more.

Read the lesson

You have a line of comma-separated values. Split it into individual values and print each one on its own line.

Expected output:

Alice
25
New York
Engineer
csv_line = "Alice,25,New York,Engineer"
# Split the line by commas and print each value

More string methods exercises

All Python exercises · 50 practice problems · Python Fundamentals quiz