I was trying to strip a string like
var/vob/bxxxxx/xxxxx/vob
I am doing it like...
'var/vob/bxxxxx/xxxxx/vob'.lstrip('/var/vob/')
I am expecting an output like ...
bxxxxx/xxxx/vob
But it is only giving...
xxxx/xxxxxx/vob
Yes I know because of the first letter is b and in python prefix b for a string stands for converting it into bytes, and I have read this too...
But what I wanted to know is how to bypass this thing.. I want to get the desired output...
I would love to say the things I have tried.. but I don't find any way around to try... can some one throw some light on this...
Thanks :)
lstripargument, since it lacks the leading/. If you want to chop a fixed prefix off a string, I'd teststartswith(prefix)and then slice, something liketest[len(prefix):].bas a marker outside the quotes. In Python 3, this would be a literal for abytesobject:b'foo', while this would be a literal for a string object:'bfoo'. In Python 2.x, theumarker serves an inverse purpose -'foo'is an encoded string, whileu'foo'is a Unicode object.