I need to join several append values. Tried as follows
lines1.append(resnum[i])
lines1.append(resname[i])
lines1.append(resnum[j])
lines1.append(resname[j])
lines1.append(j-i)
lines1.append(r1)
s1 = ' '.join(map(str,lines1))
print s1
sv = open("1.out","w")
sv.write(' '.join(map(str,lines1)))
sv.close()
But it is printing everything in one line as follows.
1 AAA 2 BBB 1 3.83433240604 2 AAA 3 BBB 1 3.82626841714 3 AAA 4 BBB 1 3.82807980586 4 AAA 5 BBB 1 3.86017836375 5 AAA 6 BBB 1 3.83235241073 6 AAA 7 BBB 3.76532115
If I try to use following.
sv.write('\n'.join(map(str,lines1)))
I get the output as follows.
1
AAA
2
BBB
1
3.83433240604
..........
..........
How to get the output as follows
1 AAA 2 BBB 1 3.83433240604
2 AAA 3 BBB 1 3.83433240604
...................................................
...................................................