Latest recipes tagged "2"http://code.activestate.com/recipes/tags/2/new/2011-10-02T15:45:11-07:00ActiveState Code RecipesPython script to create a header for Python scripts (Python) 2011-10-02T15:45:11-07:00userendhttp://code.activestate.com/recipes/users/4179007/http://code.activestate.com/recipes/577846-python-script-to-create-a-header-for-python-script/ <p style="color: grey"> Python recipe 577846 by <a href="/recipes/users/4179007/">userend</a> (<a href="/recipes/tags/2/">2</a>, <a href="/recipes/tags/auto/">auto</a>, <a href="/recipes/tags/create/">create</a>, <a href="/recipes/tags/emacs/">emacs</a>, <a href="/recipes/tags/header/">header</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/vim/">vim</a>). Revision 5. </p> <p>This will create a header for a Python script. It is a nice way keep a track of what your script does and when it was created, the author of the script, etc.. </p> <p>Update: Now, it will automatically open with one of the two most popular editors, Vim or Emacs! This script has been updated from the second version to replace spaces with underscores in the title, to convert uppercase to lowercase. It also checks to see if there is a script with the same name in the current working directory so it will not overwrite another file. Please leave comments and suggestions.</p> Chek if a number is a power of two (Python) 2010-12-23T11:29:38-08:00A. Polinohttp://code.activestate.com/recipes/users/4176317/http://code.activestate.com/recipes/577514-chek-if-a-number-is-a-power-of-two/ <p style="color: grey"> Python recipe 577514 by <a href="/recipes/users/4176317/">A. Polino</a> (<a href="/recipes/tags/2/">2</a>, <a href="/recipes/tags/check/">check</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/power/">power</a>, <a href="/recipes/tags/python/">python</a>). Revision 2. </p> <p>Pretty good way to check if a number is a power of two or not.</p>