Thursday, December 3, 2026 | London 10°C · Drizzle
DailyGlimpse

AI

Python Interview Prep: Understanding split() vs join() Methods

Tech With Mala 1 min read

In Python, both split() and join() are string methods used for manipulating text, but they serve opposite purposes:

  • split() breaks a string into a list of substrings based on a specified delimiter (default is whitespace). For example, "a,b,c".split(",") returns ['a', 'b', 'c'].
  • join() concatenates a list of strings into a single string, using a specified separator. For example, ",".join(['a', 'b', 'c']) returns "a,b,c".

These methods are commonly tested in Python interviews. Mastering them helps with data parsing, formatting, and understanding core string operations.

React