remove space in the string python code example Example 1: delete space in string python .replace(" ", "") Example 2: delete spaces in string python >>> s.replace(" ", "")