"Steven D'Aprano" <[email protected]> wrote

>>> for i in (1, 2, 3):
...     print(i, "spam", end="\n" if i==3 else "***")

Ooooh! A new trick.
I hadn't thought of using the conditional expression there but it makes a lot of sense. Definitely more fun and flexible than the old comma at the end of a print in v2 :-)

Thanks for that,

Alan G.

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to