Do not discuss off-list, maybe others will have better solutions to your
question.  And also please do not top-posting, it makes me difficult to
trim the irrelevant text.

yaffa wrote:
> sorry addr is a variable.  how to i append to that?

I know addr is a variable (or better a name).  But what object do you
assign to it?  I mean, does incident.findNextSibling('td') return a
string or an object of another type?

If your code "addr.append('%s;')" doesn't raise an exception, it is
pretty sure what assigned to addr is not a string (maybe a list, which
has an "append" method).  You can use "print addr" or "print repr(addr)"
to determine that.


> ----- Original Message ----- From: "Qiangning Hong" <[EMAIL PROTECTED]>
> To: "yaffa" <[EMAIL PROTECTED]>
> Cc: <python-list@python.org>
> Sent: Friday, August 12, 2005 12:47 PM
> Subject: Re: need help with my append syntax
> 
> 
>> 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&amp;id=67907&amp;t=1>
>>
> 


-- 
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&amp;id=67907&amp;t=1>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to