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?
我想大声告诉你2017-05-18 10:57:56
with open('a.txt') as f:
a = f.readlines()
with open('b.txt') as f:
b = f.readlines()
仅有的幸福2017-05-18 10:57:56
with open('a.txt') as f1, open('b.txt') as f2:
a, b = f1.readlines(), f2.readlines()
#接下来就可以操作a, b了