【发布时间】:2010-03-23 16:20:40
【问题描述】:
我有一些检查要做,如果检查满足,我希望打印结果。下面是代码:
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
上面的代码效果很好,但是当我打印 j 时,它会打印为 ['351', '342'] 但我希望得到 351 342(中间有一个空格)。由于它更像是一个 python 问题,所以我没有包含输入文件(基本上它们只是数字)。
谁能帮帮我?
干杯,
查瓦纳克
【问题讨论】: