我试图以这种方式从 Python调用gawk (AWK 的 GNU 实现)。
import os
import string
import codecs
ligand_file=open( "2WTKA_ab.txt", "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 )
ligand_file.close()
for i in ligand_lines:
os.system ( " gawk %s %s"%( "'{if ($2==""i"") print $0}'", 'unique_count_a_from_ac.txt' ) )
我的问题是“i”没有被它所代表的值取代。“i”表示的值是整数而不是字符串。我该如何解决这个问题?