Question: I have a string like this `str ="out = sings<=20,gef=='one'"`. Now I want to remove the first out and = but not the <= and ==. How do I do it, though we can use the replace function it replaces all the =. I only want the first word and the = sing should be removed.

My code:

```
st ="out = sings<=20,gef=='one'"
st1=st.replace('out', "")
print(st1)
st2 = st1.replace('=', "")
print(st2)

```

This gives,

```
st1: = sings<=20,gef=='one'
st2 :sings<20,gef'one'

```

Expected Output:

```
st1: = sings<=20,gef=='one'
st2 : sings<=20,gef=='one'

```

Answer: 
You can match from the start of the string the first word characters followed by an equals sign between 1 or more whitespace chars.

In the replacement use an empty string.

```
import re

st ="out = sings<=20,gef=='one'"
result = re.sub(r"^\w+\s+=\s+", "", st)
print (result)

```

Output

```
sings<=20,gef=='one'

```
You can specify the no of replacements to make using the count argument of replace.

```
st ="out = sings<=20,gef=='one'"
st1=st.replace('out', "")
print(st1)
st2 = st1.replace('=', "", 1)
print(st2)

```