Python: Write two lists into two column text file

后端 未结 6 730
我寻月下人不归
我寻月下人不归 2020-12-13 07:23

Say I have two lists: a=[1,2,3] b=[4,5,6] I want to write them into a text file such that I obtain a two column text file:



        
6条回答
  •  鱼传尺愫
    2020-12-13 08:07

    It exits a straightway to save and stack same vectors length in columns. To do so use the concatenate function, you can then stack 3,4 or N vectors in columns delimitered by a tab.

    np.savetxt('experimental_data_%s_%.1fa_%dp.txt'%(signal,angle,p_range), np.c_[DCS_exp, p_exp], delimiter="\t")
    

提交回复
热议问题