Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import punctuation
- from string import digits
- from string import letters
- from string import printable
- from string import whitespace
- def punk_stripper(inputtext):
- a = ''.join([t for t in inputtext if t not in punctuation])
- return a
- def get_numbers(inputtext):
- b = ''.join([t for t in inputtext if t in digits])
- return b
- def get_letters(inputtext):
- c = ''.join([t for t in inputtext if t in letters])
- return c
- def get_printable(inputtext):
- d = ''.join([t for t in inputtext if t in printable])
- return d
- def whitespace_stripper(inputtext):
- e = ''.join([t for t in inputtext if t not in whitespace])
- return e
- inputtext = str(raw_input('Input some text for the strippers >'))
- print "\n\n"
- print "punk_stripper:-\t",punk_stripper(inputtext)
- print "get_numbers:-\t",get_numbers(inputtext)
- print "get_letters:-\t",get_letters(inputtext)
- print "get_printable:-\t",get_printable(inputtext)
- print "whitespace_stripper:-\t",punk_stripper(inputtext)
Advertisement
Add Comment
Please, Sign In to add comment