[Tutor] working with strings in python3

tktucker at gmail.com tktucker at gmail.com
Tue Apr 19 02:27:58 CEST 2011


Your code worked fine for me. Is it possible your "test" variable wasn't  
true?

>>> message = "Bah."

>>> message = message + " Humbug!"
>>> print(message)
Bah. Humbug!





On Apr 18, 2011 8:17pm, Rance Hall <ranceh at gmail.com> wrote:
> Ok so I know what I am doing is deprecated (or at least poor form) but

> the replacement must be awkward cause I'm not getting it.





> so this is in a cli based program designed to print status messages to

> the terminal on a linux box.



> pseudo code:





> message = "Bah."



> if test:

> message = message + " Humbug!"



> print(message)



> end pseudo code





> I'm sure this is not the way we are supposed to augment strings like this.



> maybe there is string.append() method or something I should be using  
> instead?



> In my case the optional extra parts are always at the end of the

> current value of the string.





> Thanks for clearing this up for me.



> Rance

> _______________________________________________

> Tutor maillist - Tutor at python.org

> To unsubscribe or change subscription options:

> http://mail.python.org/mailman/listinfo/tutor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110419/4ac32f0b/attachment.html>


More information about the Tutor mailing list