What goes in the blank?
# keep only the digits: 'a1b2' -> '12' digits = ''.join(c for c in s if c.____())
Answer: isdigit
isdigit is True for digit characters, so the generator keeps just those.
Play Problem Solving ▸
# keep only the digits: 'a1b2' -> '12' digits = ''.join(c for c in s if c.____())
Answer: isdigit