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