raffalib.list_replace
Functions
|
Replace all occurrences of a value in a list (in place). |
Module Contents
- raffalib.list_replace.list_replace(lst, old, new)
Replace all occurrences of a value in a list (in place).
- Parameters:
lst (list) – The list to modify (modified in place).
old – The value to replace.
new – The new value to insert.
- Returns:
None
- Return type:
None
- Example:
>>> from raffalib import list_replace >>> lst = [1, 2, 3, 2, 4] >>> list_replace(lst, 2, 5) >>> lst [1, 5, 3, 5, 4]