Re: Insert variable into text search string

2014-02-19 Thread Chris Angelico
On Thu, Feb 20, 2014 at 7:15 AM, Kevin Glover 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 a

Re: Insert variable into text search string

2014-02-19 Thread Kevin Glover
Thank you both so much. I had tried % but not successfully. -- https://mail.python.org/mailman/listinfo/python-list

Re: Insert variable into text search string

2014-02-19 Thread Jussi Piitulainen
Kevin Glover writes: > These two lines are from a program that carries out a phrase search > of Wikipedia and returns the total number of times that the specific > phrase occurs. It is essential that the search contains an > apostrophe: > > results = w.search("\"of the cat's\"", type=ALL, start=1

Re: Insert variable into text search string

2014-02-19 Thread MRAB
On 2014-02-19 19:39, Kevin Glover wrote: These two lines are from a program that carries out a phrase search of Wikipedia and returns the total number of times that the specific phrase occurs. It is essential that the search contains an apostrophe: results = w.search("\"of the cat's\"", type=A