Is there a function to chomp last character in the string if it’s some special character? For example, I need to remove backslash if it’s there, and do nothing, if not. I know I can do it with regex easily, but wonder if there something like a small built-in function for that.
Share
Use
rstripto strip the specified character(s) from the right side of the string.See: http://docs.python.org/library/stdtypes.html#str.rstrip