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