Python Strip Unexpected Behavior
I was stripping a file name in python for routing purposes and I was getting some unexpected behavior with the python strip function. I've read the docs and searched online but hav
Solution 1:
strip()
would strip all the characters provided in the argument - in your case .
, m
and d
.
Instead, you can use os.path.splitext()
:
import osos.path.splitext("Getting-StarteX.md")[0]
Post a Comment for "Python Strip Unexpected Behavior"