I have a randomly generated list of which contains letters, symbols, and numbers and need to separate it into 2 lists -one of numbers and one of the remaining chars. Then I need to separate the numbers into 2 lists-one of composite numbers (4,6,8,9) and one a list of prime numbers(2,3,5,7). I can make a list of the numbers, but it doesn't separate it from the list:

>>>sdigits=''.join([letter for letter in s if letter.isdigit()])

but if I then 'print s' the numbers are still in it. Any ideas?

Don't give up, just keep going ...

s = "1#%$^5hbg458#$54bjyfuig324ghal&%90a11y$#6ty7"

str_digits = ''.join([c for c in s if c.isdigit()])
str_nodigits = ''.join([c for c in s if not c.isdigit()])

str_comp = ''.join([c for c in str_digits if int(c) in (4,6,8,9)])
str_prime = ''.join([c for c in str_digits if int(c) in (2,3,5,7)])


my result -->

Ah....! That's it! I didn't realize I could add 'not' like that. Thanks again