Let\'s say I have this list of asterisks, and I say it to print this way:
list = [\'* *\', \'*\', \'* * *\', \'* * * * *\', \'* * * * * *\', \'* * * *\'] for
myList = ['* *', '*', '* * *', '* * * * *', '* * * * * *', '* * * *'] import itertools for i in itertools.izip_longest(*myList, fillvalue=" "): if any(j != " " for j in i): print " ".join(i)
Output
* * * * * * * * * * * * * * * * * * * * *