how to remove last two characters in a python string code example Example: python remove last 4 characters from string foo = foo[:-n]