Popular recipes by Andrew Yurisich http://code.activestate.com/recipes/users/4180867/2012-04-06T16:06:17-07:00ActiveState Code RecipesSplit Up Text File by Line Count (Python) 2012-02-19T23:40:47-08:00Andrew Yurisichhttp://code.activestate.com/recipes/users/4180867/http://code.activestate.com/recipes/578045-split-up-text-file-by-line-count/ <p style="color: grey"> Python recipe 578045 by <a href="/recipes/users/4180867/">Andrew Yurisich</a> (<a href="/recipes/tags/split/">split</a>, <a href="/recipes/tags/text_files/">text_files</a>). Revision 5. </p> <p>Splits a large text file into smaller ones, based on line count. Original file is unmodified.</p> <p>Resulting text files are stored in the same directory as the original file.</p> <p>Useful for breaking up text based logs or blocks of email logins into smaller parts.</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> Quickly add all dirs to sys.path if dir has .py file (Python) 2012-04-06T16:06:17-07:00Andrew Yurisichhttp://code.activestate.com/recipes/users/4180867/http://code.activestate.com/recipes/578097-quickly-add-all-dirs-to-syspath-if-dir-has-py-file/ <p style="color: grey"> Python recipe 578097 by <a href="/recipes/users/4180867/">Andrew Yurisich</a> (<a href="/recipes/tags/add/">add</a>, <a href="/recipes/tags/os_walk/">os_walk</a>, <a href="/recipes/tags/sys_path/">sys_path</a>). Revision 2. </p> <p>Add all dirs under <code>folder</code> to sys.path if any .py files are found. Use an abspath if you'd rather do it that way.</p> <p>Uses the current working directory as the location of using.py. Keep in mind that os.walk goes <em>all the way</em> down the directory tree.</p> Print a List of Places (ie, Rankings) (Python) 2012-02-25T05:37:41-08:00Andrew Yurisichhttp://code.activestate.com/recipes/users/4180867/http://code.activestate.com/recipes/578052-print-a-list-of-places-ie-rankings/ <p style="color: grey"> Python recipe 578052 by <a href="/recipes/users/4180867/">Andrew Yurisich</a> (<a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/listing/">listing</a>, <a href="/recipes/tags/ranking/">ranking</a>). </p> <p>Hopefully this function will save you the trip to oocalc/excel. Py3k code.</p>