Popular recipes tagged "substitute" but not "function"http://code.activestate.com/recipes/tags/substitute-function/2012-03-23T20:44:23-07:00ActiveState Code RecipesFor Characters in a String, Replace with Character (Python) 2012-03-23T20:44:23-07:00Andrew Yurisichhttp://code.activestate.com/recipes/users/4180867/http://code.activestate.com/recipes/578086-for-characters-in-a-string-replace-with-character/ <p style="color: grey"> Python recipe 578086 by <a href="/recipes/users/4180867/">Andrew Yurisich</a> (<a href="/recipes/tags/character/">character</a>, <a href="/recipes/tags/replace/">replace</a>, <a href="/recipes/tags/substitute/">substitute</a>, <a href="/recipes/tags/text/">text</a>). Revision 9. </p> <p>Useful if you need to replace many different characters with all of the same character. Can accept an unlimited number of request to replace.</p> <p>Does not work with words, only characters. You can, however, replace single characters with words. I may go back and re-implement it using tuples for the keys, but this would make searching the text for any matches pretty expensive, I'd imagine. At that point, it's mostly a job for a regex, and those tools already exist.</p> Recursively querying for registry subkeys (Python) 2009-07-28T03:23:29-07:00Heinz Hermannhttp://code.activestate.com/recipes/users/4171265/http://code.activestate.com/recipes/576860-recursively-querying-for-registry-subkeys/ <p style="color: grey"> Python recipe 576860 by <a href="/recipes/users/4171265/">Heinz Hermann</a> (<a href="/recipes/tags/regdeletetree/">regdeletetree</a>, <a href="/recipes/tags/registry/">registry</a>, <a href="/recipes/tags/substitute/">substitute</a>, <a href="/recipes/tags/win32api/">win32api</a>). Revision 2. </p> <p>Because the Windows XP API does not support the RegDeleteTree function, the programmer has to query for subkeys of a registry key recursively, before he can delete it. This functions returns all subkeys of a registry key in deleteable order, which means the deepest subkey is the first in the list. </p>