how to remove spaces in a list python code example Example: python remove spaces string=' t e s t ' print(string.replace(' ',''))