3 examples of 'python remove string from list' in Python

Every line of 'python remove string from list' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
392def _check_remove_item(the_list, item):
393 """Helper function for merge_lists that implements checking wether an items
394 should be removed from the list and doing so if needed. Returns ``True`` if
395 the item has been removed and ``False`` otherwise."""
396 if not isinstance(item, basestring):
397 return False
398 if not item.startswith('~'):
399 return False
400 actual_item = item[1:]
401 if actual_item in the_list:
402 del the_list[the_list.index(actual_item)]
403 return True
42def remove(value, delete_chars):
43 for c in delete_chars:
44 value = value.replace(c, '')
45 return value
1def remove(s):
2 i = 0
3 j = 0
4
5 while i < len(s):
6 if s[i] == 0:
7 i+=1
8 else:
9 s[j] = s[i]
10 i+=1
11 j+=1
12
13 while j < len(s):
14 s[j] = 0
15 j+=1
16
17 return s

Related snippets