Here is a snippet of my code:
blahblahblah...
blah[]
for link in goodies.soup.find_all('a'):
blah.append(link.get('href'))
blah=list(set(blah))
which gives my list of urls. So now I use a regex to search for the relevant urls which I want in a list:
for r in blah:
capture=re.findall(r'https://.*', r)
print (capture)
which prints the results as:
[]
['https://blah.org/plugins/blahblahblahblah/']
[]
[]
['https://blah.org/plugins/blahblahblah/']
What I am trying to do is create a list from these results. When I attempt to do this, I always run into a brickwall:
for r in blah:
capture=re.findall(r'https://.*', r)
purls=[]
purls.append(capture)
purls
[[]]
for r in blah:
capture=re.findall(r'https://.*', r)
purls=[]
for a in capture:
purls.append(a)
purls
[]
This is the closest thing I could come up with:
for r in blah:
capture=re.findall(r'https://.*', r)
rolos=capture[:]
print rolos
[]
['https://blah.org/plugins/blahblahblahblah/']
[]
[]
['https://blah.org/plugins/blahblahblah/']
whos
rolos list n=0
But as you can see, it didnt create the list???? What am I doing wrong and how can this be accomplished ?
---------- Post updated at 05:01 PM ---------- Previous update was at 04:34 PM ----------
so it turned out to be the +=, which is the increment operator
for r in blah:
capture=re.findall(r'https://.*', r)
rolos+=capture[:]
Thanks to dslackw for providing this insane resolution. I still cant believe it.