how do i get round this error then because i have a mixed list of file names and their size i need it sorted by the size and i get errors trying to sort the size on its own because of they way it pairs the file name and the size as it runs though a folder

For example like this, but start new thread and include link to old thread in your message.

list_of_mixup= ['name',123123,'sdfa',342]
iter_list = iter(list_of_mixup)
fine_list = []

while True:
    try:
        no_mix = (next(iter_list),next(iter_list))
    except StopIteration:
        break
    else:
        fine_list.append(no_mix)

print(fine_list)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.