I'm trying to loop through two lists and create tuple with it and then return list.
m = re.findall(reg, request) //List of all names from website
i = re.findall(reg2, request) //job title.
lst = []
for name in m:
for job in i: #<======= Can't access name after this point
if name and job:
tub = (name, job)
if tub not in lst:
lst.append(tub)
elif name:
tub = (name, None)
if tub not in lst:
lst.append(tub)
print(lst)
return lst
With this input it is:
print(m) -> ['Name Nameson']
print(i) -> []
But it seem like i can't access the name variable in the inner loop. If set print(name) in the outer loop it shows but not in the inner. So the return is always [].
I'm new to python what I'am i doing wrong here?