Human word reader
superpollo
utente at esempio.net
Sat May 15 08:35:04 EDT 2010
timo verbeek ha scritto:
> I'm planning to create a human word program
> A human inputs a string
> "Give me the weather for London please."
> Then I will strip the string.
> "weather for london"
> Then I get the useful information.
> what:"weather" where:"london"
> After that I use the info.
>
> I need help with getting the useful information how do I get the place
> if I don't now how long the string is?
>>> query = "Give me the weather for London please."
>>> what = query.strip("Give me the ").split()[0]
>>> where = query.strip("Give me the " + what + " for ").split()[0]
>>> print what, where
weather London
>>>
More information about the Python-list
mailing list