#!/usr/local/bin/python3 dirnames = ['_1','2','_3','4','_5','6','_7','8','_9','0']*10 for i in range(10000): dirnames[:] = [dn for dn in dirnames if not dn.startswith('_')] print(dirnames)