Popular Python recipes tagged "character"http://code.activestate.com/recipes/langs/python/tags/character/2016-01-13T00:46:40-08:00ActiveState Code Recipesadd password masking ability to getpass.getpass() (Python)
2016-01-13T00:46:40-08:00KingMakhttp://code.activestate.com/recipes/users/4193393/http://code.activestate.com/recipes/579148-add-password-masking-ability-to-getpassgetpass/
<p style="color: grey">
Python
recipe 579148
by <a href="/recipes/users/4193393/">KingMak</a>
(<a href="/recipes/tags/character/">character</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/getpass/">getpass</a>, <a href="/recipes/tags/hiding/">hiding</a>, <a href="/recipes/tags/masking/">masking</a>, <a href="/recipes/tags/msvcrt/">msvcrt</a>, <a href="/recipes/tags/password/">password</a>, <a href="/recipes/tags/windows/">windows</a>).
</p>
<p>adding the ability to display a password masking character of the programmer's choice</p>
For 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>
Frequency Analyser (Python)
2011-08-11T09:26:56-07:00Stijn de Graafhttp://code.activestate.com/recipes/users/4178055/http://code.activestate.com/recipes/577837-frequency-analyser/
<p style="color: grey">
Python
recipe 577837
by <a href="/recipes/users/4178055/">Stijn de Graaf</a>
(<a href="/recipes/tags/analysis/">analysis</a>, <a href="/recipes/tags/analyze/">analyze</a>, <a href="/recipes/tags/character/">character</a>, <a href="/recipes/tags/cryptography/">cryptography</a>, <a href="/recipes/tags/frequency/">frequency</a>).
</p>
<p>Calculates the frequency of characters within a block of text. In the context of cryptography, these values can be compared to a frequency table in order to attempt to ascertain the original message.</p>
Special Range Function for Different Kinds of Ranges (int, float, character) (Python)
2011-03-30T16:42:47-07:00Sunjay Varmahttp://code.activestate.com/recipes/users/4174115/http://code.activestate.com/recipes/577583-special-range-function-for-different-kinds-of-rang/
<p style="color: grey">
Python
recipe 577583
by <a href="/recipes/users/4174115/">Sunjay Varma</a>
(<a href="/recipes/tags/character/">character</a>, <a href="/recipes/tags/float/">float</a>, <a href="/recipes/tags/integer/">integer</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/range/">range</a>, <a href="/recipes/tags/special/">special</a>).
Revision 3.
</p>
<p>This module allows the user to create a more verbose set of ranges. Simple character ranges, and float ranges are supported.</p>
<p>Supported Ranges:</p>
<ul>
<li>Basic Integer Ranges</li>
<li>Float Ranges (as accurate as a float range can get)</li>
<li>Simple character ranges (lowercase to lowercase, uppercase to uppercase, etc.)</li>
</ul>
<p>It should work in Python 2 and Python 3.</p>
<p><strong>If you tested this for speed, or want to test this for speed, please post the results! (And your system specs)</strong></p>
<p><strong>Edit:</strong> Found a really silly error of mine when using range instead of xrange in these functions!</p>