Popular recipes tagged "merge" but not "python"http://code.activestate.com/recipes/tags/merge-python/2010-05-21T10:00:14-07:00ActiveState Code RecipesCheetah template processor for CSV and XML data (Python)
2010-05-21T10:00:14-07:00Raphaël Jolivethttp://code.activestate.com/recipes/users/4135673/http://code.activestate.com/recipes/577234-cheetah-template-processor-for-csv-and-xml-data/
<p style="color: grey">
Python
recipe 577234
by <a href="/recipes/users/4135673/">Raphaël Jolivet</a>
(<a href="/recipes/tags/cheetah/">cheetah</a>, <a href="/recipes/tags/csv/">csv</a>, <a href="/recipes/tags/merge/">merge</a>, <a href="/recipes/tags/populate/">populate</a>, <a href="/recipes/tags/template/">template</a>, <a href="/recipes/tags/xml/">xml</a>).
</p>
<p>This script allows to populate Cheetah text templates (<a href="http://www.cheetahtemplate.org/" rel="nofollow">http://www.cheetahtemplate.org/</a>) with XML or CSV input data.</p>
<p>This is useful in my day2day work, where I often need to quickly generate bunch of files based on a templates and data.</p>
<p>Cheetah template are very easy to write and understand, and I find it easy to use with CSV or XML data.</p>
Merge multiple (potentially infinite) sorted inputs into a single sorted output (Python)
2010-04-01T04:54:16-07:00Gabriel Genellinahttp://code.activestate.com/recipes/users/924636/http://code.activestate.com/recipes/577041-merge-multiple-potentially-infinite-sorted-inputs-/
<p style="color: grey">
Python
recipe 577041
by <a href="/recipes/users/924636/">Gabriel Genellina</a>
(<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/merge/">merge</a>, <a href="/recipes/tags/sort/">sort</a>).
Revision 4.
</p>
<p>Merge a (possibly infinite) number of already sorted inputs (each of possibly infinite length) into a single sorted output.</p>
<p>Similar to heapq.merge and sorted(itertools.chain(*iterables)).</p>
<p>Like heapq.merge, returns a generator, does not pull the data into memory all at once, and assumes that each of the input iterables is already sorted (smallest to largest).</p>
<p>Unlike heapq.merge, accepts an infinite number of input iterables, but requires all of them to come in ascending order (that is, their starting point must come in ascending order).</p>
<p>In addition, accepts a <em>key</em> function (like <code>sorted</code>, <code>min</code>, <code>max</code>, etc.)</p>