
## replace {#str-str}

Replaces an existing token with a new token. Does nothing if the first token doesn't exist.


### Returns 


Boolean `true` if the token was found and replaced, `false` otherwise.


```python
def replace(self, token, new_token):
    ...
```


| Parameter | Type | Description |
| :- | :- | :- |
| token | str | The token you want to replace. |
| new_token | str | The token you want to replace the old token with. |



### See Also
* module [`aspose.html.collections`](../../)
* class [`DOMTokenList`](/html/python-net/aspose.html.collections/domtokenlist)
