Reading data from 2 different files and writing to a single file
insideshoes at gmail.com
Mon Jan 28 16:18:08 CET 2013
> That's "zip" not "Zip"
> Have you tried looking at the docs? Or even typing help(zip) at the
> python interpreter prompt?
> In rough terms, zip takes one element (line) from each of the iterators,
> and creates a new list that holds tuples of those elements. If you use it
> in this form:
> for item1, item2 in zip(iter1, iter2):
> then item1 will be the first item of iter1, and item2 will be the first
> item of iter2. You then process them, and loop around. It stops when
> either iterator runs out of items.
> gives me http://docs.python.org/2/**library/functions.html#zip<http://docs.python.org/2/library/functions.html#zip>
> as the first link.
> This will read the entire content of both files into the list, so if they
> are more than 100meg or so, you might want to use izip(). (In Python3.x,
> zip will do what izip does on Python 2.x)
Thanks Dave, I am Sorry , true I dint look up for it because as per the
Suggetion by Chris, 'break' does solve my problem but I wanted to know a
little about 'zip' for I encounter any other problem, parsing these two
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list