[Tutor] something relevant to array

Asokan Pichai pasokan at talentsprint.com
Fri Dec 23 13:26:22 CET 2011


On Fri, Dec 23, 2011 at 3:31 PM, lina <lina.lastname at gmail.com> wrote:
>
> Hi,
>
[SNIPPED]

> 2] I want to combine a series of files like
>
> a.txt
>
> 1 a
> 2 a
> 3 a
>
> b.txt
>
> 1 b
> 2 b
> 3 b
>
> into one as:
> a b
> a b
> a b
>

Is this ok?

----------------------------------------------------------------------------------------
a = [line.split()[1] for line in open('a.txt') if len(line.strip()) == 26]
b = [line.split()[1] for line in open('b.txt') if len(line.strip()) == 26]
both = zip(a, b)
----------------------------------------------------------------------------------------

Asokan Pichai


More information about the Tutor mailing list