Python reads the content of a document and extracts it for processing
仅有的幸福
仅有的幸福 2017-05-18 10:55:56
0
2
676

There is a text document 1, the data is divided into lines, as follows:
12345
32561
96854
12368
52697
......
Another Text document 2 is also data in the same format, as follows:
112233
123456
789652
123698
125896
......
Want to read document 1 For each line of document 2, extract each line of data into a variable; then read each line of document 2, extract each line of data into another variable, and then operate these two variables. How to do this?

仅有的幸福
仅有的幸福

reply all(2)
我想大声告诉你
with open('a.txt') as f:
    a = f.readlines()
    
with open('b.txt') as f:
    b = f.readlines()
    
仅有的幸福
with open('a.txt') as f1, open('b.txt') as f2:
    a, b = f1.readlines(), f2.readlines()
    #接下来就可以操作a, b了
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template