What is the output of the following Python code? print(“a,b,,c”.split(“,”))
Correct answer B. ['a', 'b', '', 'c']
Explanation
When a separator is given, split() treats consecutive separators as delimiting empty strings, so the two adjacent commas produce an empty string item. Only split() with no argument collapses runs of whitespace and discards empty items. This difference often matters when parsing CSV-like data with blank fields.
Answer checked How we write and check questions
Discussion