Unit: Unit 4: Strings, Lists, and Tuples • Interactive Practice
Interactive Python programming tutorial and practice in your browser.
# Split log strings and delimited records into structured lists
csv_row = "item_101,Mechanical Keyboard,99.50,In Stock"
sentence = "Python makes data parsing fast and intuitive"
# 1. Split CSV row by comma delimiter ','
fields = csv_row.split(",")
# 2. Split sentence by whitespace (default)
words = sentence.split()
print("CSV fields:", fields)
print("Word count:", len(words))
print("First word:", words[0], "| Last word:", words[-1])