Insert variable into text search string
Chris Angelico
rosuav at gmail.com
Wed Feb 19 21:06:21 EST 2014
On Thu, Feb 20, 2014 at 7:15 AM, Kevin Glover <kevingloveruk at gmail.com> wrote:
> Thank you both so much. I had tried % but not successfully.
To do it with %, just do this:
whatever = "cat"
results = w.search("\"of the %s's\""%whatever, type=ALL, start=1, count=1)
Use either that or .format(), whichever you like - both are fully
supported, and they have different strengths.
ChrisA
More information about the Python-list
mailing list