I would like to assign the following expression to a variable:
textFormat = 'soup.find("div", {"class" : "article-entry text"}).text.replace(\'\n\', "")'
I am calling this code in another file using
text = exec(textFormat)
Sadly I get the error message:
File "C:\Users\dadsad\documents\coding\dasdasd\functions.py", line 42, in loadAtom
text = exec(textFormat) File "<string>", line 1
soup.find("div", {"class" : "article-entry text"}).text.replace('
^ SyntaxError: EOL while scanning string literal
Any ideas? Thanks! :)

\\nprint(textFormat)and actually look at the value you assigned, you'll have a pretty good idea yourself.exec. That being said,execandevalare antipatterns.exec()always returnsNone. Perhaps you meant to useeval()instead?