Latest update and explanation: For those who really don't understand why this was being done, I was using an Excel API in Python. The Python script would pull strings from the Excel spreadsheet for automated tests and return results to Excel when completed. I would also update a database, but have since quit the idea, and the need for Excel on this project, due to the difficulties we have seen in the discussions.
For example, I understand you can...
my_string = "driver.find_element_by_id(%s).click()" % foo
but how can I apply the data to an already assigned string. What would be the Pythonic way to...
my_string = 'driver.find_element_by_id(%s).click()'
new_string = my_string % foo
UPDADED: Playing with quotes got me sidetracked. Not exactly what I want on the final product but this is what now works...
these str objects pulled in from another source (so no way to join before assigning to variables)...
a = "driver.find_element_by_id('%s').click()"
sel_selector = "foo"
my_string = a % sel_selector
eval(my_string)
Most of my logic of capturing the data from an Excel spreadsheet has been left out, but that is why it became so complicated. It is a script that pulls data from a spreadsheet, so we can have automated regression testing that updates the sheet.