I'm writing code to read two text files and print output for each line in first file with all lines on file 2
try:
with open("file1.txt", "r") as ins , open("file2.txt", "r") as ins2 :
array = []
for line in ins:
#print(line)
# Start inner for
for line2 in ins2:
print(line + " : " + line2)
except IOError as e:
print 'Operation failed: %s' % e.strerror
file 1 content samples :
text1
text2
text3
file 2 content sample :
1985
1986
1987
output must be
text1 :1985
text1 :1986
text1 :1987
text2 :1985
text2 :1986
.
.
.
.