3 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Gribouillis

Any sequence of python strings can be disguised to look like a file opened for reading, which can then be passed on the fly to functions expecting such an input file. This code snippet defines the necessary adapter class. The obtained file-like objects store only one string of the sequence …

Member Avatar for Gribouillis
2
1K
Member Avatar for TrustyTony

Here is class that can be fed directly from split stream like one number per line file (or [URL="http://www.daniweb.com/software-development/python/code/321725"]generator producing 'words'[/URL] from multiple numbers per line).

Member Avatar for Gribouillis
0
607
Member Avatar for Gribouillis

This snippet defines a function to merge sorted iterables containing similar items into a single iterable. Items are supposed to be sorted in ascending order. Only one item per iterable is stored at a time.

Member Avatar for Gribouillis
0
584

The End.