AskMerlin, your AI expert system guru oracle advisor

Peter Hansen peter at engcorp.com
Mon Oct 29 00:58:32 EST 2001


Ron Stephens wrote:
> 
> x = (self._getGoogleHits(self.question + ' ' + reply))
>                 y = (self._getGoogleHits(reply))
> 
> I am not sure what the significance of the (self.question + ' ' +reply) is.
> Specifically, what is the significance of the two quotation marks in the
> middle? Doe sit just ad a space between the two strings (question and
> reply), or does it do something else?

Python is exceptionally friendly about this kind of question
when you use the interactive prompt.  It's worth spending a
moment getting used to it:

>>> someString = 'this is a test'
>>> reply = 'and a reply'
>>> someString + reply
'this is a testand a reply'
>>> someString + ' ' + reply
'this is a test and a reply'
>>> '%s %s' % (someString, reply)
'this is a test and a reply'

Enjoy! :)

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list