I have 2 arrays which contains some numbers:
RA=['20 12 40.0319', '15 15 48.4459'...'10 57 3.0215']
DEC=['-02 08 39.97', '-37 09 16.03'...'+22 42 39.07']
I want to merge these arrays as one, like:
POS=['20 12 40.0319 -02 08 39.97','15 15 48.4459 -37 09 16.03','10 57 3.0215 +22 42 39.07']
So basically i want to merge i-th element of both one at ith element of new array with a tab between them. How can i do that?
>Solution :
The
zip()function returns a zip object, which is an iterator of tuples where the first item in each passed iterator is paired together, and then the second item in each passed iterator are paired together etc.
If the passed iterators have different lengths, the iterator with the least items decides the length of the new iterator.
POS = [i+' '+k for i, k in zip(RA,DEC)]