KnowledgeBoat Logo

Computer Science

Which of the following methods splits the string at the first occurrence of separator and returns a tuple containing three items?

  1. index()
  2. partition()
  3. split()
  4. count()

Python Tuples

3 Likes

Answer

partition()

Reason — The partition() method splits the string at the first occurrence of the specified separator and returns a tuple containing three elements: the part before the separator, the separator itself, and the part after the separator.

Answered By

1 Like


Related Questions