Drucken von Elementen aus der Liste

Ich muss eine bestimmte Prüfung durchführen, und wenn die Prüfung zufriedenstellend ist, möchte ich, dass das Ergebnis gedruckt wird. Unten ist der Code:

import string
import codecs
import sys
y=sys.argv[1]

list_1=[]
f=1.0
x=0.05
write_in = open ("new_file.txt", "w")
write_in_1 = open ("new_file_1.txt", "w")
ligand_file=open( y, "r" ) #Open the receptor.txt file
ligand_lines=ligand_file.readlines() # Read all the lines into the array
ligand_lines=map( string.strip, ligand_lines ) #Remove the newline character from all     the pdb file names
ligand_file.close()

ligand_file=open( "unique_count_c_from_ac.txt", "r" ) #Open the receptor.txt file
ligand_lines_1=ligand_file.readlines() # Read all the lines into the array
ligand_lines_1=map( string.strip, ligand_lines_1 ) #Remove the newline character from all the pdb file names
ligand_file.close()
s=[]
for i in ligand_lines:
   for j in ligand_lines_1:
      j = j.split()
      if i == j[1]:
     print j

Der obige Code funktioniert prima, aber wenn ich j drucke, druckt er wie ['351', '342'], aber ich erwarte 351 342 (mit einem Leerzeichen dazwischen). Da es sich eher um eine Python-Frage handelt, habe ich die Eingabedateien nicht berücksichtigt (im Grunde handelt es sich nur um Zahlen).

Kann mir jemand helfen?

Prost,

Chavanak

Antworten auf die Frage(2)

Ihre Antwort auf die Frage