need help with my append syntax

Qiangning Hong hongqn at gmail.com
Fri Aug 12 12:47:58 EDT 2005


yaffa wrote:
> dear folks,
> 
> i'm trying to append a semicolon to my addr string and am using the
> syntax below.  for some reason the added on of the ; doesn't work.
> when i print it out later on it only shows the original value of addr.
> 
> addr = incident.findNextSibling('td')
> addr.append('%s;')

Is addr is really a string?  AFAIK, strings havn't an append methond.

use += to extend strings:

.>>> addr = 'abc'
.>>> addr += '%s;'
.>>> addr
'abc%s;'

-- 
Qiangning Hong

I'm usually annoyed by IDEs because, for instance, they don't use VIM
as an editor. Since I'm hooked to that, all IDEs I've used so far have
failed to impress me.
    -- Sybren Stuvel @ c.l.python

Get Firefox!
<http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1>



More information about the Python-list mailing list