python remove last character from string if comma code example Example: python remove last 4 characters from string foo = foo[:-n]