Popular recipes tagged "flatten" but not "python"http://code.activestate.com/recipes/tags/flatten-python/2014-03-21T16:09:39-07:00ActiveState Code RecipesPython - from nD array to flat array (Python)
2014-03-21T16:09:39-07:00Roberto Bellohttp://code.activestate.com/recipes/users/4189498/http://code.activestate.com/recipes/578854-python-from-nd-array-to-flat-array/
<p style="color: grey">
Python
recipe 578854
by <a href="/recipes/users/4189498/">Roberto Bello</a>
(<a href="/recipes/tags/array/">array</a>, <a href="/recipes/tags/flatten/">flatten</a>, <a href="/recipes/tags/nd/">nd</a>).
</p>
<p>From a multidimensional array to a flat array avoiding numpy.
The code could be better?</p>
Flatten Array/Tuple (Python)
2011-10-31T10:53:39-07:00Luca Zarottihttp://code.activestate.com/recipes/users/4179728/http://code.activestate.com/recipes/577932-flatten-arraytuple/
<p style="color: grey">
Python
recipe 577932
by <a href="/recipes/users/4179728/">Luca Zarotti</a>
(<a href="/recipes/tags/array/">array</a>, <a href="/recipes/tags/flatten/">flatten</a>, <a href="/recipes/tags/tuple/">tuple</a>).
</p>
<p>Flatten a nested array/tuple</p>
Flatten XML to XPath syntax lines (Python)
2011-01-19T16:05:24-08:00Raphaël Jolivethttp://code.activestate.com/recipes/users/4135673/http://code.activestate.com/recipes/577547-flatten-xml-to-xpath-syntax-lines/
<p style="color: grey">
Python
recipe 577547
by <a href="/recipes/users/4135673/">Raphaël Jolivet</a>
(<a href="/recipes/tags/flatten/">flatten</a>, <a href="/recipes/tags/grep/">grep</a>, <a href="/recipes/tags/sed/">sed</a>, <a href="/recipes/tags/xml/">xml</a>, <a href="/recipes/tags/xpath/">xpath</a>).
</p>
<p>This script acts like <a href="http://www.ofb.net/~egnor/xml2/">xml2</a>.
It transforms a XML file into a flat text output, with <em>XPath</em>-like syntax, one line per XML node or attribute.
This format is more suitable for working with standard unix CLI utils (sed, grep, ... etc).</p>
Flattening lists (Python)
2010-12-21T16:04:38-08:00Michael Pucketthttp://code.activestate.com/recipes/users/4176295/http://code.activestate.com/recipes/577509-flattening-lists/
<p style="color: grey">
Python
recipe 577509
by <a href="/recipes/users/4176295/">Michael Puckett</a>
(<a href="/recipes/tags/flatten/">flatten</a>, <a href="/recipes/tags/list/">list</a>).
</p>
<p>Classic / frequently asked, <em>'How to flatten a list, regardless the nesting.'</em></p>
Flatten a list (Python)
2010-06-18T03:45:20-07:00Giannis Fysakishttp://code.activestate.com/recipes/users/4174072/http://code.activestate.com/recipes/577250-flatten-a-list/
<p style="color: grey">
Python
recipe 577250
by <a href="/recipes/users/4174072/">Giannis Fysakis</a>
(<a href="/recipes/tags/flatten/">flatten</a>, <a href="/recipes/tags/list/">list</a>).
Revision 3.
</p>
<p>Flatten a list </p>
flatten sequences (Python)
2008-09-05T08:41:49-07:00Christophe Simonishttp://code.activestate.com/recipes/users/4166953/http://code.activestate.com/recipes/576487-flatten-sequences/
<p style="color: grey">
Python
recipe 576487
by <a href="/recipes/users/4166953/">Christophe Simonis</a>
(<a href="/recipes/tags/flatten/">flatten</a>, <a href="/recipes/tags/list/">list</a>).
Revision 3.
</p>
<p>A simple method to flatten a sequence (list, tuple...)</p>