lets say we have a very big string. and we want to display only 100 characters in the stdout. and the remaining will go to the next line. my first method will be using index slicing and set the startIndex to increment by 100 and so on:
while (veryLargeStringLength/100 > 0):
startIndex = 0
veryLargeString[startIndex :startIndex+100]
startIndex += 100
veryLargeStringLength -= 100
Is this the most efficient way to do this? Any other optimization method? I would say that there is no point in cosidering multiThreaded or multiprocessing in this scenario?
Thanks
startIndex = 0inside thewhileloop