import re data = [ 'The heart was made to be broken.\n', 'There is no surprise more magical than the surprise of being loved.\n' ] for line in data: line_split = re.findall(r'[^ \t\n\r, ]+',line) print line_split
Standard input is empty
['The', 'heart', 'was', 'made', 'to', 'be', 'broken.'] ['There', 'is', 'no', 'surprise', 'more', 'magical', 'than', 'the', 'surprise', 'of', 'being', 'loved.']