Created
April 4, 2012 12:34
-
-
Save richo/2300809 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyString(str): | |
def processed(self): | |
half1 = self[0:10].rstrip(' ') | |
half2 = self[11:].rstrip('\n') | |
return [half1, half2] | |
def reflect_statement(sentence): | |
elements = [] | |
sensplit = [] | |
for line in open("reflections.txt"): | |
mys = MyString(line) | |
elements.append(mys.processed()) | |
while ' ' in sentence: | |
word = sentence[0:(sentence.find(' ') + 1)] | |
sensplit += [word.rstrip(' ')] | |
sentence = sentence.replace(word, '') | |
sensplit += [sentence] | |
sen = range(len(sensplit) | |
def punct(ptype): | |
if ptype in sensplit[k]: | |
print sensplit[k] | |
for k in sen: | |
punct('?') | |
punct('!') | |
punct(',') | |
print sensplit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment