Here is some example code:
def printAsGrid(listName,rowLength):
gridStr=''
for n in range(len(listName)):
if n % rowLength == 0:
gridStr += '\n'
gridStr += listName[n] +''
else:
gridStr += listName[n]
print(gridStr)
myList = []
for i in range(20):
myList.append('a')
print(myList)
for i in range(0,20):
myList[i] = "b"
printAsGrid(myList,5)
I've looked here and I know about \r
and the ANSI exit codes but it doesn't work for windows terminal (they did work for the ubuntu terminal).