On Tue, May 29, 2012 at 03:51:21PM +1000, Steven D'Aprano wrote:
> > Using + is arguably preferable when you have a choice to make, since it
> > works in all cases, including constants.
>
> I'll argue differently: even though + works with string literals as well
> as variables, you shouldn't us
On Mon, May 28, 2012 at 07:07:20PM -0700, Steve Willoughby wrote:
> On 28-May-12 19:00, Jeremy Duenas wrote:
> >and the both printed the same output……so why would I want to use
> >‘+’ to
> >add strings if there seems to be no reason too?
>
> Juxtaposing strings only works with constants, which ma
t now.
From: brian arb [mailto:brianjames...@gmail.com]
Sent: Monday, May 28, 2012 7:22 PM
To: Jeremy Duenas
Cc: tutor@python.org
Subject: Re: [Tutor] Concatenating Strings
Your right that example from the book is a terrible example the point or the
reason to concatenating strings.
here
On 28-May-12 19:00, Jeremy Duenas wrote:
and the both printed the same output……so why would I want to use ‘+’ to
add strings if there seems to be no reason too?
Juxtaposing strings only works with constants, which may be convenient
in some cases, but it won't work at all when concatenating othe
Your right that example from the book is a terrible example the point or
the reason to concatenating strings.
here is a simple usage of where concatenating strings prints out a simple
string as a counter in a loop.
>>> for i in range(5):
... print(str(i) + ' in for loop')
...
0 in for loop
1
On 05/28/2012 10:00 PM, Jeremy Duenas wrote:
> I am trying to understand the point behind using the '+' character when
> trying to concatenate strings. I am new to learning Python and going through
> the book "Python Programming for Absolute Beginners 3rd ed." and do not
> understand the point or
I am trying to understand the point behind using the '+' character when
trying to concatenate strings. I am new to learning Python and going through
the book "Python Programming for Absolute Beginners 3rd ed." and do not
understand the point or reason for concatenating strings. The reason I do
no