Member Avatar

Evening Community! Alright. As you can see I am "newbie" on the block. When I try approaching my professor for assistance she tells me to go to my book. But I digress. If I was able to use a while loop this would be more simplified. But our professor is asking us to use a FOR loop and we have to use 2 functions. Alright, easy enough. but WAIT, theres more. So below is my code but unfortunately I am getting back the awful " TypeError: 'module' object is not iterable I am sure it is something I completely overlooking …

Member Avatar
0
37
Member Avatar

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 at a time (which limits some file operations, seek() doesn't work backwards for example). This code was inspired by the standard library's StringIO module. Please note that when memory or disk access is not an issue, it may be more efficient to write a temporary file than to use this …

Member Avatar
2
17
Member Avatar

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
0
16
Member Avatar
Reusable Code Snippet Merge Sorted Iterables

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
0
14

The End.