Merge two files in python

Asked

Viewed 49 times

-1

I have two lists in python and I want to leave these two files in one. That is, I have two files that contain a column with 360 lines and I want to leave in a single file (because I need to make a matrix chart) with two columns and 360 lines. How do I do? I have tried to join the two as an arrangement in numpy but what happens is that it includes as more rows instead of creating a column on the side, getting a file of 720 rows and not with two columns of 360 rows. Someone can help me?

1 answer

0


try to create a list by concatenating the two

#criando as duas listas para exemplo
a=[x for x in range(360)]
b=[y for y in range(361,721)]

#criando a nova lista
uniao=[]

#juntando as duas
for z in range(360):
    uniao.append([a[z],b[z]])
  • It worked. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.