Here's a very dummy example of what I'm trying to accomplish, input is text:
{placeholder}, John Jones\n{placeholder}, Ben Franklin\n{placeholder}, George Washington
What I want to do is replace every instance of {placeholder} with the output of a function using data from the same line, e.g. the first initial and last name (would need to input first and last name to a function).
def initializer(name):
return f"{name.split(' ')[0][0]}. {name.split(' ')[1]}"
The desired result would be:
J. Jones, John Jones\nB. Franklin, Ben Franklin\nG. Washington, George Washington
"{placeholder}, John Jones\n{placeholder}, Ben Franklin\n{placeholder}, George Washington"? or do you have the names in a list?