python读取大文件
d={}a_in = open("testfile.txt", "r")
for line in a_in:
columnssplit = line.rstrip().split("\t")
d]=columnssplit
a_in.close()
ID_test = open("correlation.txt", "r")
for line in ID_test:
s = line.rstrip().split("\t")
if s in d:
print s+"\t"+d]
ID_test.close()
## Here is another example
f = open("test.txt", "r")
while True:
line = f.readline()
if line: #或者用 if line != "":
print line
else:
break
f.close()
页:
[1]