Reading data from 2 different files and writing to a single file

inshu chauhan 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.
>
> https://duckduckgo.com/?q=**python+zip<https://duckduckgo.com/?q=python+zip>
>    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)
>
>
>
> --
> DaveA
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>



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
files.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130128/cfb7579d/attachment.html>


More information about the Python-list mailing list