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