Apr-27-2023, 01:20 PM
Quote:But I get [0, 1, 2, 3, 4, 5], the indexes of the complete Char_List is shown instead of the numeric content. Thanks.The problem is you never referenced the items in the list. This gives you sequence of numbers whose only relation to the list is the count is the same.
for entry in range(len(Char_List)): # entry is not an item from the list. It is a number 0 to 5Your code would work fine if you checked the actual list values.
Char_List = ['Bla', 'Blu', 10, 20, 30, 40] Num_List = [] for entry in Char_List: #<- Loop through the list values if type(entry) != str: Num_List.append(entry) print(Num_List)