On Sat, May 15, 2010 at 9:32 PM, timo verbeek <timoverbee...@gmail.com>wrote:

> On May 15, 1:02 pm, timo verbeek <timoverbee...@gmail.com> wrote:
> Place starts always with for
>

Okay, much better.

Given that constraint, it looks like regular expression can do the job. I'm
not very experienced with regex, though.

\w* matches a whole word composed of letters and numbers by default.

>>> result = re.search('for \w*', 'Give me the weather for London please.')
>>> result.group()
'for London'
>>> result.group().split()[1]
'London'

Cheers,
Xav
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to