delete last string in for loop python code example Example: python remove last 4 characters from string foo = foo[:-n]