I believe strip
is the pythonic way. It is usually the case when there is a builtin function.
There are a few builtin path manipulators available in the os
library. You might want to use them if one of the manipulators is a match for your use case.