Most viewed recipes tagged "ascii"http://code.activestate.com/recipes/tags/ascii/views/2016-11-13T20:17:03-08:00ActiveState Code Recipesslugify: make a string usable in a URL or filename (Python) 2010-06-07T04:11:55-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577257-slugify-make-a-string-usable-in-a-url-or-filename/ <p style="color: grey"> Python recipe 577257 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/filename/">filename</a>, <a href="/recipes/tags/slug/">slug</a>, <a href="/recipes/tags/slugify/">slugify</a>, <a href="/recipes/tags/url/">url</a>). Revision 2. </p> <p>"Slugify" a string so it is ascii, has only alphanumeric and hyphen characters. Useful for URLs and filenames. This is heavily based on the slugify in Django.</p> <p>Note: presumes that you've <code>import re</code>d higher up in your module.</p> Printing an ASCII table to PDF (Python) 2015-04-02T18:38:04-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579043-printing-an-ascii-table-to-pdf/ <p style="color: grey"> Python recipe 579043 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to print part of an ASCII table to PDF. It shows it for the first 32 ASCII characters, the control characters, i.e. the characters with ASCII codes 0 to 31. The same logic can be extended to print the remaining ASCII characters, either upto code 127 or 255, depending on your definition of ASCII, and also on whether your PDF font supports printing all those characters.</p> Pi Circle (Python) 2012-05-13T04:35:46-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/578130-pi-circle/ <p style="color: grey"> Python recipe 578130 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/art/">art</a>, <a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/fun/">fun</a>, <a href="/recipes/tags/pi/">pi</a>). Revision 5. </p> <p>Computes Pi to many decimal places and prints the digits in a circle.</p> Ascii Encryptor (Python) 2008-10-10T10:53:04-07:00Erik Andersonhttp://code.activestate.com/recipes/users/4155471/http://code.activestate.com/recipes/576535-ascii-encryptor/ <p style="color: grey"> Python recipe 576535 by <a href="/recipes/users/4155471/">Erik Anderson</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/encryption/">encryption</a>). </p> <p>Converts a string of characters to ascii</p> tgraph - Simple ASCII graphing utility (Python) 2011-07-28T21:13:23-07:00Drew Gulinohttp://code.activestate.com/recipes/users/4119417/http://code.activestate.com/recipes/577077-tgraph-simple-ascii-graphing-utility/ <p style="color: grey"> Python recipe 577077 by <a href="/recipes/users/4119417/">Drew Gulino</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/graph/">graph</a>, <a href="/recipes/tags/log/">log</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/tail/">tail</a>, <a href="/recipes/tags/unix/">unix</a>). </p> <p>Takes a stream of numbers and outputs simple ASCII graphs of those numbers</p> Trap KeyboardInterrupt and EOFError for graceful program termination (Python) 2016-11-13T20:17:03-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580718-trap-keyboardinterrupt-and-eoferror-for-graceful-p/ <p style="color: grey"> Python recipe 580718 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/error/">error</a>, <a href="/recipes/tags/exception/">exception</a>, <a href="/recipes/tags/handler/">handler</a>, <a href="/recipes/tags/shutdown/">shutdown</a>, <a href="/recipes/tags/terminate/">terminate</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>This recipe shows how to trap the KeyboardInterrupt and EOFError Python exceptions so that they do not crash your program. As a vehicle to show this, it uses a small Python utility that shows the ASCII code for any ASCII character you type.</p> Python AsciiColor and video attributes (Python) 2014-07-24T04:25:53-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578908-python-asciicolor-and-video-attributes/ <p style="color: grey"> Python recipe 578908 by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/dynamic_method/">dynamic_method</a>, <a href="/recipes/tags/metaprogramming/">metaprogramming</a>, <a href="/recipes/tags/python/">python</a>). Revision 5. </p> <p>This is a subclass of a standard str object that adds methods for applying color, and video attributes to text.</p> generates a set of binary files by doing ASCII replacements on a master binary file, controlled by a csv file (Python) 2015-09-16T16:25:49-07:00Antoni Gualhttp://code.activestate.com/recipes/users/4182514/http://code.activestate.com/recipes/579099-generates-a-set-of-binary-files-by-doing-ascii-rep/ <p style="color: grey"> Python recipe 579099 by <a href="/recipes/users/4182514/">Antoni Gual</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/replace/">replace</a>). </p> <p>A hack that saved me a lot of time. Well perhaps not so much, but it was funnier than to do it manually. </p> naive natural sort (Python) 2011-08-13T16:47:36-07:00Romain Dartigueshttp://code.activestate.com/recipes/users/4167472/http://code.activestate.com/recipes/577679-naive-natural-sort/ <p style="color: grey"> Python recipe 577679 by <a href="/recipes/users/4167472/">Romain Dartigues</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/sort/">sort</a>). </p> <p>I wrote this after reading The Alphanum Algorithm (<a href="http://www.davekoelle.com/alphanum.html" rel="nofollow">http://www.davekoelle.com/alphanum.html</a>) by David Koelle a few years ago; my goal was to improve the performances of the Python version of his scripts.</p> <p>My version is approximatly 10 times faster than it's <code>alphanum.py</code> and about 3 times faster than the <code>alphanum.py_v2.4</code> on my computer, yielding the same results (for non-unicode at least).</p> <p><strong>Note</strong>: see the version of wizkid in the comments which is even faster.</p> ascii2wide Translate printable non-whitespace ascii characters to wide characters (Python) 2013-06-20T20:23:09-07:00Gary Eakinshttp://code.activestate.com/recipes/users/470921/http://code.activestate.com/recipes/578577-ascii2wide-translate-printable-non-whitespace-asci/ <p style="color: grey"> Python recipe 578577 by <a href="/recipes/users/470921/">Gary Eakins</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/translate/">translate</a>, <a href="/recipes/tags/wide/">wide</a>). </p> <p>Translates ascii characters to wide characters.</p> ascii anamation module (Python) 2013-08-22T16:20:58-07:00Andrew Wayne Teesdale Jr.http://code.activestate.com/recipes/users/4187305/http://code.activestate.com/recipes/578622-ascii-anamation-module/ <p style="color: grey"> Python recipe 578622 by <a href="/recipes/users/4187305/">Andrew Wayne Teesdale Jr.</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/text_anamation/">text_anamation</a>). Revision 2. </p> <p>module to anamate text using a simple hack def clear(): print "\n"*1000</p> ASCII art Sphere with integer square root (Batch) 2016-06-06T10:09:38-07:00Antoni Gualhttp://code.activestate.com/recipes/users/4182514/http://code.activestate.com/recipes/580673-ascii-art-sphere-with-integer-square-root/ <p style="color: grey"> Batch recipe 580673 by <a href="/recipes/users/4182514/">Antoni Gual</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/graphics/">graphics</a>). Revision 2. </p> <p>The code draws a sphere in ASCII Art. Square root routine bt Aacini</p>