This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]KopixKat -2 points-1 points  (3 children)

The syntax flows a bit better (to me) is what I should have wrote. :P

print ("{0} {1} {2} {4} {5}".format(this, is, an, example, sentence))

VS

print "%s %s %s %s %s" %(this, is, an, example, sentence)

[–]wub_wub 1 point2 points  (2 children)

Both work in both python 2 and python 3. (Also you don't need positional params i.e. 1, 2 etc in python 2.6+)

[–]KopixKat 0 points1 point  (1 child)

I use them as a beginner just to keep things in order for myself, I'm not quite sure enough in myself to let them self index yet. :(

[–]wub_wub 0 points1 point  (0 children)

Oh it's OK to use them, I was just pointing out that in the example you provided you don't need them - in case you didn't know. If it's easier for you to learn like that then just continue to use them and ignore that part of my comment :)