find the punctuation : findall « Regular Expressions « Python Tutorial






import re

text = '"Hm Err -- are you sure?" he said, sounding insecure.'

pat = r'[.?\-",]+'
print re.findall(pat, text)








16.2.findall
16.2.1.re.findall returns a list of all occurrences of the given pattern
16.2.2.find the punctuation
16.2.3.Find a string