[Tutor] append string

Tom Tucker tktucker at gmail.com
Sat Mar 22 02:44:23 CET 2008


Strings are immutable, you can't append to them.

How about this....

>>> mystring = 'Elis'

>>> mystring.append('Aeris')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'append'


>>> mystring + ' Aeris'
'Elis Aeris'
>>> x = mystring + ' Aeris'
>>> print x
Elis Aeris



On Fri, Mar 21, 2008 at 8:04 PM, elis aeris <hunter92383 at gmail.com> wrote:

> how do I append to the end of strings?
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080321/9e02710b/attachment.htm 


More information about the Tutor mailing list