python re delete all spaces at the end code example Example: python remove spaces string=' t e s t ' print(string.replace(' ',''))