How to print each element of a list until a certain length Python

Question:

How to print each element of my list to a defined length (5), so for example:

myList = ["abcdefgh", "ijklmnop"]

The output I’m looking for is:

abcde
ijklm

I’ve tried this (printing dates from an excel sheet):

i = 2
x =0
while i < maxR:
    valuesItems =  wb0["C" + str(rowList[i])].value
    itemDate.append(valuesItems)
    print(len(itemDate[x]))
    i = i+1
    x = x+1

But this prints "19" multiple times (the length of each element, not the element itself)

Asked By: Panther Motos

||

Answers:

for element in myList:
    print(element[:5])
Answered By: jprebys