[Tutor] working with strings in python3
James Mills
prologic at shortcircuit.net.au
Tue Apr 19 02:35:42 CEST 2011
On Tue, Apr 19, 2011 at 10:34 AM, James Mills
<prologic at shortcircuit.net.au> wrote:
> Normally it's considered bad practise to concatenate strings.
> Use a a format specifier like this:
>
>> message = "Bah."
>>
>> if test:
>> message = "%s %s" (message, " Humbug!")
>>
>> print(message)
>
> Python3 (afaik) also introduced the .format(...) method on strings.
Opps I posted to the wrong list :/
--
-- James Mills
--
-- "Problems are solved by method"
More information about the Tutor
mailing list