python string trim last 3 chars code example Example: python remove last 4 characters from string foo = foo[:-n]