[英] python itertools dont load files into memory
我有一些很大的文件,我正试图用这些代码获得所有的组合
for text1, text2 in itertools.product(open('text1.txt'), open('text2.txt')):
t3 = (text1.strip() + text2.strip())
time.sleep(1)
print(t3)
使用小文件进行测试,效果很好,但当使用大文件时,什么都没有发生,我猜它会将文件加载到内存中,所以不会将整个文件加载到内存中