So lets say for example I had a list
list1 = ["George", "47", "62", "71", "Apples"]
Is there a way I could do something like list2 = list1[1:4]
and convert all of those values to integers at the same time, or at least right after.
EDIT:
What I just now implemented was right after the assignment of it (so in this case right after list2 = list1[1:4]
) I did a for loop that was formatted as the following
for i in range(len(list2) :
list2[i] = int(list2[i])
I feel this isn't the most elegant way to do this, so I still would appreciate any input, as I have multiple lists I need to do this to so doing it this way multiple times feels... sloppy to say the least.