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
>>>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to