There you go… each line is put into an index of the array so if
test0.txt had ‘a’, ‘b’, and ‘c’ on one line each and test1.txt had ‘1’,
‘2’, and ‘3’ on one line then the commands above result in printing out ‘a 1’.
Good luck.
mstrickland16 wrote:
> Something I haven’t been able to find the answer to in browsing a number
> of basic and advanced guides…
>
> To simplify my goal, take the following demonstration:
>
> -I have 2 files:
>
> “letters” which consists of:
>
> a
> b
> c
>
> ----------------------------------
>
> “numbers” which consists of:
>
> 1
> 2
> 3
>
> ----------------------------------
>
> What is the easiest way to read these variables in such that I can
> work with them in pairs of “a 1” “b 2” …?
>
> Can variable ‘pairs’ be read in using a "for x in cat letters" type
> statement? That would work fine for my purposes.
>
> Or, possibly the better solution, what is the easiest way to read the
> files into 2 separate arrays?
>
> Many Thanks in advance.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/