Last active
August 29, 2015 14:20
-
-
Save alejio/8c6bcbc3412c5e700a3b to your computer and use it in GitHub Desktop.
Nanodegree > MongoDB > Lesson 4 > Problem set 1 > Omitting text in parentheses
This file contains 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
def trim_par(line): | |
outp = [] | |
comp=re.compile(r'\(+\S+\)', re.IGNORECASE) | |
linesplit=line.split() | |
for index in range(0, len(linesplit)): | |
m = comp.search(linesplit[index]) | |
if m: | |
continue | |
else: | |
outp.append(linesplit[index] | |
outp=' '.join(outp) | |
return outp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment