According to the documentation, the lstrip
function remove the characters in chars.
>>> help(str.lstrip)
Help on method_descriptor:
lstrip(...)
S.lstrip([chars]) -> str
Return a copy of the string S with leading whitespace removed.
**If chars is given and not None, remove characters in chars instead.**
So st.lstrip('Product=')
removes "P", "r", "o", "d", "u", "c", "t", "=" at the beginning of "Product=Product Name 25". Then, the two words are removed!
I think your string represents a "key=value" pair.
The best way to split it is to use split()
method:
st = "Product=Product Name 25"
key, value = st.split("=")
print("key: " + key)
print("value: " + value)
You get:
key: Product
value: Product Name 25
Only the value:
value = st.split("=")[1]
print("value only: " + value)
You get:
value only: Product Name 25
If you want a "left-trim":
p = "Product="
value = st[len(p):]
print("trimmed value: " + value)
You get:
trimmed value: Product Name 25