string - Python: How to not print comma in last element in a for loop? -
my code iterates on set , print actor's names:
for actor in actorsbymovies(): print actor+",",
the result looks like:
brad pitt, george clooney,
but want detect last element won't print last comma. result should instead:
brad pitt, george clooney
how can that?
print ', '.join(actorsbymovies())
Comments
Post a Comment