I have an enormous string and I’ve created a list of all the matching patterns in that string called ‘found’. I’ve also created a list of all the locations of said patterns called ‘locations’. Now I want to print the pattern found and its corresponding location all in one line, separated by a tab, but i’m getting tripped up on the loops. Here’s my latest attempt:
for i in found:
print i + '\t' + locations['i']
but I obviously get an error. I can get it to print the locations or the patterns or one then the other, but i’m not quite sure how to get them all on the same line.
edit: the variables are found = a list of strings (patterns found in the overall string) and locations = a list of the locations of said patterns found using re.finditer
eitehr way, zip() worked perfectly for my needs. thanks.
try
zip():