for issn in inputList:
link = journalresults.find('a', attrs={'href' : re.compile(issn + '$')})
I am trying to use the variable ‘issn’ with re.compile and append ‘$’ after it but have tried umpteen combinations while searching for a resolution that all have come up unsucessful.
Obviously I am missing something simple. I am just looking to find ‘issn’ within the href attribute. It appears at the end so that is why I want to append $ after the ‘issn’ variable.
Edit: using the comment to try ‘print >>sys.stderr, repr(issn)’, I see there is a newline after the issn that I needed to strip. Thank you for the newbie help.
Did you check what type the variable
issnis? Useprint >>sys.stderr, repr(issn)and check what you get. Additionally, what error message is printed? Did you debug your program, for example by using import pdb at the top and using pdb.set_trace() right before the compile statement?